为什么netty 4.1可以';找不到LongObjectHashMap和LongObjectMap
我只是从为什么netty 4.1可以';找不到LongObjectHashMap和LongObjectMap,netty,Netty,我只是从Github(branchorigin/4.1)中克隆了Netty,但我无法运行示例,从而导致此错误 我找不到这个类,甚至在netty common中找不到包,在github上也找不到,我该怎么办?这些都是生成的。。。运行/mvnw clean compile 您可以看到,在common/src/script中有一个groovy脚本,内容是 String[] templateDirs = [properties["collection.template.dir"],
Github(branchorigin/4.1)
中克隆了Netty,但我无法运行示例,从而导致此错误
我找不到这个类,甚至在
netty common
中找不到包,在github
上也找不到,我该怎么办?这些都是生成的。。。运行/mvnw clean compile
您可以看到,在common/src/script
中有一个groovy脚本,内容是
String[] templateDirs = [properties["collection.template.dir"],
properties["collection.template.test.dir"]]
String[] outputDirs = [properties["collection.src.dir"],
properties["collection.testsrc.dir"]]
templateDirs.eachWithIndex { templateDir, i ->
convertSources templateDir, outputDirs[i]
}
void convertSources(String templateDir, String outputDir) {
String[] keyPrimitives = ["byte", "char", "short", "int", "long"]
String[] keyObjects = ["Byte", "Character", "Short", "Integer", "Long"]
String[] keyNumberMethod = ["byteValue", "charValue", "shortValue", "intValue", "longValue"]
keyPrimitives.eachWithIndex { keyPrimitive, i ->
convertTemplates templateDir, outputDir, keyPrimitive, keyObjects[i], keyNumberMethod[i]
}
}
void convertTemplates(String templateDir,
String outputDir,
String keyPrimitive,
String keyObject,
String keyNumberMethod) {
def keyName = keyPrimitive.capitalize()
def replaceFrom = "(^.*)K([^.]+)\\.template\$"
def replaceTo = "\\1" + keyName + "\\2.java"
def hashCodeFn = keyPrimitive.equals("long") ? "(int) (key ^ (key >>> 32))" : "(int) key"
ant.copy(todir: outputDir) {
fileset(dir: templateDir) {
include(name: "**/*.template")
}
filterset() {
filter(token: "K", value: keyName)
filter(token: "k", value: keyPrimitive)
filter(token: "O", value: keyObject)
filter(token: "KEY_NUMBER_METHOD", value: keyNumberMethod)
filter(token: "HASH_CODE", value: hashCodeFn)
}
regexpmapper(from: replaceFrom, to: replaceTo)
}
}
这意味着
通过maven的buildhelper maven plugin
plugin和codegen.groovy
脚本读取templates目录中的脚本,可以在所需的集合包下生成特定的类
因此,当您执行mvn clean install
时,它们将以以下方式生成: