39
39
@ Disabled ("Test disabled until we can solve how to load the tests in a classloader that allows access to internal types." )
40
40
public class Java17TypeSignatureBuilderTest implements JavaTypeSignatureBuilderTest {
41
41
private static final String goat = StringUtils .readFully (
42
- Java17TypeSignatureBuilderTest .class .getResourceAsStream ("/JavaTypeGoat.java" ));
42
+ Java17TypeSignatureBuilderTest .class .getResourceAsStream ("/JavaTypeGoat.java" ));
43
43
44
44
private static final JCTree .JCCompilationUnit cu = ReloadableJava17Parser .builder ()
45
- .logCompilationWarningsAndErrors (true )
46
- .build ()
47
- .parseInputsToCompilerAst (
48
- singletonList (new Parser .Input (Paths .get ("JavaTypeGoat.java" ), () -> new ByteArrayInputStream (goat .getBytes (StandardCharsets .UTF_8 )))),
49
- new InMemoryExecutionContext (Throwable ::printStackTrace ))
50
- .entrySet ()
51
- .iterator ()
52
- .next ()
53
- .getValue ();
45
+ .logCompilationWarningsAndErrors (true )
46
+ .build ()
47
+ .parseInputsToCompilerAst (
48
+ singletonList (new Parser .Input (Paths .get ("JavaTypeGoat.java" ), () -> new ByteArrayInputStream (goat .getBytes (StandardCharsets .UTF_8 )))),
49
+ new InMemoryExecutionContext (Throwable ::printStackTrace ))
50
+ .entrySet ()
51
+ .iterator ()
52
+ .next ()
53
+ .getValue ();
54
54
55
55
@ Override
56
56
public String fieldSignature (String field ) {
57
57
return new TreeScanner <String , Integer >() {
58
58
@ Override
59
59
public String visitVariable (VariableTree node , Integer integer ) {
60
- if (node .getName ().toString ().equals (field )) {
60
+ if (node .getName ().toString ().equals (field )) {
61
61
return signatureBuilder ().variableSignature (((JCTree .JCVariableDecl ) node ).sym );
62
62
}
63
63
//noinspection ConstantConditions
@@ -78,7 +78,7 @@ public String methodSignature(String methodName) {
78
78
@ Override
79
79
public String visitMethod (MethodTree node , Integer p ) {
80
80
JCTree .JCMethodDecl method = (JCTree .JCMethodDecl ) node ;
81
- if (method .getName ().toString ().equals (methodName )) {
81
+ if (method .getName ().toString ().equals (methodName )) {
82
82
return signatureBuilder ().methodSignature (method .type , method .sym );
83
83
}
84
84
//noinspection ConstantConditions
@@ -99,7 +99,7 @@ public String constructorSignature() {
99
99
@ Override
100
100
public String visitMethod (MethodTree node , Integer p ) {
101
101
JCTree .JCMethodDecl method = (JCTree .JCMethodDecl ) node ;
102
- if (method .name .toString ().equals ("<init>" )) {
102
+ if (method .name .toString ().equals ("<init>" )) {
103
103
return signatureBuilder ().methodSignature (method .type , method .sym );
104
104
}
105
105
//noinspection ConstantConditions
@@ -120,7 +120,7 @@ public Type firstMethodParameter(String methodName) {
120
120
@ Override
121
121
public Type visitMethod (MethodTree node , Integer p ) {
122
122
JCTree .JCMethodDecl method = (JCTree .JCMethodDecl ) node ;
123
- if (method .getName ().toString ().equals (methodName )) {
123
+ if (method .getName ().toString ().equals (methodName )) {
124
124
List <JCTree .JCVariableDecl > params = method .getParameters ();
125
125
return params .iterator ().next ().type ;
126
126
}
@@ -142,7 +142,7 @@ public Object innerClassSignature(String innerClassSimpleName) {
142
142
@ Override
143
143
public Type visitClass (ClassTree node , Integer integer ) {
144
144
JCTree .JCClassDecl clazz = (JCTree .JCClassDecl ) node ;
145
- if (innerClassSimpleName .equals (clazz .getSimpleName ().toString ())) {
145
+ if (innerClassSimpleName .equals (clazz .getSimpleName ().toString ())) {
146
146
return clazz .type ;
147
147
}
148
148
return super .visitClass (node , integer );
0 commit comments