File tree Expand file tree Collapse file tree 5 files changed +36
-1
lines changed
main/java/org/minimallycorrect/javatransformer/internal
test/java/org/minimallycorrect/javatransformer Expand file tree Collapse file tree 5 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -246,10 +246,16 @@ private Type resolveClassType(String name) {
246246 // inner class in imported class
247247 if (preDotName != null && importName .endsWith (preDotName )) {
248248 String fullName = importName + postDotName ;
249+ // TODO: we can either resolve with $ or . here depending on if in source or byte code
250+ // should make consistent by always using $ for inner class names
249251 Type type = resolveIfExists (fullName );
250252 if (type != null ) {
251253 return type ;
252254 }
255+ type = resolveIfExists (importName + postDotName .replace ('.' , '$' ));
256+ if (type != null ) {
257+ return type ;
258+ }
253259 }
254260 }
255261
Original file line number Diff line number Diff line change @@ -137,6 +137,9 @@ public static int accessStringToInt(String access) {
137137 case "synthetic" :
138138 a |= AccessFlags .ACC_SYNTHETIC ;
139139 break ;
140+ case "final" :
141+ a |= AccessFlags .ACC_FINAL ;
142+ break ;
140143 default :
141144 throw new TransformationException ("Unknown access string " + access );
142145 }
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ public void testTransform() throws Exception {
9393 c .getMembers ().collect (Collectors .toList ());
9494 c .getConstructors ().collect (Collectors .toList ());
9595 c .getMethods ().forEach (it -> {
96- it .getReturnType ();
96+ val rt = it .getReturnType ();
9797
9898 val cf = it .getCodeFragment ();
9999
Original file line number Diff line number Diff line change 1+ package org .minimallycorrect .javatransformer .transform ;
2+
3+ public @interface AnnotationInnerClassExample {
4+ enum TestEnum {
5+ ONE ,
6+ TWO
7+ }
8+ }
Original file line number Diff line number Diff line change 11package org .minimallycorrect .javatransformer .transform ;
22
3+ import java .lang .invoke .MethodHandles ;
4+
35public class InnerClassReferencer {
46 public InnerClassExample .Inner test1 () {
57 throw new UnsupportedOperationException ();
@@ -8,4 +10,20 @@ public InnerClassExample.Inner test1() {
810 public org .minimallycorrect .javatransformer .transform .InnerClassExample .Inner2 test2 () {
911 throw new UnsupportedOperationException ();
1012 }
13+
14+ public AnnotationInnerClassExample .TestEnum test3 () {
15+ throw new UnsupportedOperationException ();
16+ }
17+
18+ public org .minimallycorrect .javatransformer .transform .AnnotationInnerClassExample .TestEnum test4 () {
19+ throw new UnsupportedOperationException ();
20+ }
21+
22+ public MethodHandles .Lookup test5 () {
23+ throw new UnsupportedOperationException ();
24+ }
25+
26+ public java .lang .invoke .MethodHandles .Lookup test6 () {
27+ throw new UnsupportedOperationException ();
28+ }
1129}
You can’t perform that action at this time.
0 commit comments