Add test for ECJ compiling an enum with a constructor parameter annotation

This commit is contained in:
Chris Smowton
2024-08-02 16:02:35 +01:00
parent 08bb794f76
commit ee11307751
7 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
| Annotation processors enabled: true | 1 |
| Number of calls with call target | 5 |
| Number of calls with missing call target | 0 |
| Number of expressions with known type | 21 |
| Number of expressions with unknown type | 0 |
| Number of files | 697 |
| Number of files with extension class | 692 |
| Number of files with extension java | 2 |
| Number of files with extension properties | 2 |
| Number of lines of code | 6 |
| Number of lines of code with extension java | 6 |
| Percentage of calls with call target | 100 |
| Percentage of expressions with known type | 100 |
| Total number of lines | 11 |
| Total number of lines with extension java | 11 |
| Used annotation processor: lombok.launch.AnnotationProcessorHider$AnnotationProcessor | 1 |
| Used annotation processor: lombok.launch.AnnotationProcessorHider$ClaimingProcessor | 1 |

View File

@@ -0,0 +1 @@
Telemetry/ExtractorInformation.ql

View File

@@ -0,0 +1,9 @@
public enum Test {
A("A"), B("B"), C("C");
private Test(@Ann String x) { }
}
@interface Ann {}

View File

@@ -0,0 +1,2 @@
public class Test2 { Test t; }

View File

@@ -0,0 +1 @@
| Test.java:5:16:5:28 | x | Test.java:5:16:5:19 | Ann |

View File

@@ -0,0 +1,8 @@
import urllib.request
from create_database_utils import *
urllib.request.urlretrieve("https://repo1.maven.org/maven2/org/eclipse/jdt/ecj/3.38.0/ecj-3.38.0.jar", "ecj.jar")
# This tests the case where ECJ emits a RuntimeIn/VisibleAnnotations attribute that isn't the same size as the corresponding method argument list, in particular due to forgetting to include the synthetic parameters added to explicit enumeration constructors.
run_codeql_database_create(["java -cp ecj.jar org.eclipse.jdt.internal.compiler.batch.Main Test.java -d out -source 8", "java -cp ecj.jar org.eclipse.jdt.internal.compiler.batch.Main Test2.java -cp out -source 8"], lang="java")

View File

@@ -0,0 +1,4 @@
import java
from Parameter p
select p, p.getAnAnnotation()