Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public void testFoo() {
@Singleton
static class Configured {

@Deprecated
@Inject
@ConfigProperty(name = "foos")
String[] foos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,24 @@ static String componentType(MethodInfo method) {
}

static String generatedSharedName(DotName annotationName) {
// when the annotation is a java.lang annotation we need to use a different package in which to generate the literal
// otherwise a security exception will be thrown when the literal is loaded
String nameToUse = isJavaLang(annotationName.toString())
? AbstractGenerator.DEFAULT_PACKAGE + annotationName.withoutPackagePrefix()
: annotationName.toString();

// com.foo.MyQualifier -> com.foo.MyQualifier1_Shared_AnnotationLiteral
return annotationName + SHARED_SUFFIX + ANNOTATION_LITERAL_SUFFIX;
return nameToUse + SHARED_SUFFIX + ANNOTATION_LITERAL_SUFFIX;
}

private static boolean isJavaLang(String s) {
return s.startsWith("java.lang");
}

static String generatedLocalName(String targetPackage, String simpleName, String hash) {
// com.foo.MyQualifier -> com.bar.MyQualifier_somehashvalue_AnnotationLiteral
return targetPackage + "." + simpleName + hash + AnnotationLiteralGenerator.ANNOTATION_LITERAL_SUFFIX;
return (isJavaLang(targetPackage) ? AbstractGenerator.DEFAULT_PACKAGE : targetPackage) + "." + simpleName + hash
+ AnnotationLiteralGenerator.ANNOTATION_LITERAL_SUFFIX;
}

}