njit-jerse / specimin

SPECIfication MINimizer. A different kind of slicer for Java.
MIT License
0 stars 5 forks source link

290 total errors on taregtMethod minimization #298

Open jonathan-m-phillips opened 1 month ago

jonathan-m-phillips commented 1 month ago

While trying to run the following commands, we are receiving a total of 290 errors.

./gradlew run --args=--outputDirectory "/my/tempDir" --root "/path/to/checker-framework/javacutil/src" --targetFile "main/java/org/checkerframework/javacutil/BasicAnnotationProvider.java" --targetMethod "org.checkerframework.javacutil.BasicAnnotationProvider#isSideEffectFree(ExecutableElement)"

Note: Recompile with -Xlint:unchecked for details. Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 100 errors 1 warning only showing the first 100 errors, of 290 total; use -Xmaxerrs if you would like to see more

From what I am seeing, the majority of the errors are stating the following:

error: incompatible types:

error: cannot find symbol

error: method does not override or implement a method from

This issue was found running on ASHE. When trying to compile any files that should have been minimized from org.checkerframework.javacutil.BasicAnnotationProvider#isSideEffectFree(ExecutableElement), we are only getting one file outputted during the minimization, main/java/org/checkerframework/javacutil/BasicAnnotationProvider.java. #isSideEffectFree(ExecutableElement) is dependent on AnnotationUtils.areSameByName being available. The compilation is as follows:

Specimin output:
/tempy/dir/main/java/org/checkerframework/javacutil/BasicAnnotationProvider.java:13: error: cannot find symbol
            boolean found = AnnotationUtils.areSameByName(am, "org.checkerframework.dataflow.qual.SideEffectFree");
                            ^
  symbol:   variable AnnotationUtils
  location: class BasicAnnotationProvider
1 error

The issue persists throughout the entirety of the file.

kelloggm commented 1 month ago

@jonathan-m-phillips I'm not able to reproduce this problem (i.e., "290 errors"). In particular, Specimin seems to run to completion on the given target with no errors (although the output does not compile). More details on exactly what I did below:

I ran the following command on the main branch of Specimin:

./gradlew run --args='--outputDirectory "/Users/mjk76/Research/code-review-verification/playground/cf-out" --root "/Users/mjk76/jsr308/checker-framework/javacutil/src" --targetFile "main/java/org/checkerframework/javacutil/BasicAnnotationProvider.java" --targetMethod "org.checkerframework.javacutil.BasicAnnotationProvider#isSideEffectFree(ExecutableElement)"'

The copy of the Checker Framework is at the current head of the master branch (3b1badbb2d). Specimin was also at the current head of its main branch (2d15714).

The result is a successful Specimin run (i.e., the ./gradlew run command terminates with BUILD SUCCEEDED). The output contains a single file ./main/java/org/checkerframework/javacutil/BasicAnnotationProvider.java. Attempting to compile this file leads to the following output from javac:

main/java/org/checkerframework/javacutil/BasicAnnotationProvider.java:13: error: cannot find symbol
            boolean found = AnnotationUtils.areSameByName(am, "org.checkerframework.dataflow.qual.SideEffectFree");
                            ^
  symbol:   variable AnnotationUtils
  location: class BasicAnnotationProvider
1 error

While I agree that this is a bug (and I'll look into fixing it), this seems like a relatively minor issue. ASHE should just skip this target, right?

jonathan-m-phillips commented 4 weeks ago

@kelloggm "While I agree that this is a bug (and I'll look into fixing it), this seems like a relatively minor issue. ASHE should just skip this target, right?"

I agree that ASHE should be able to skip these issues, but from my findings, many of the errors we are seeing in javacutuil is specifically from this issue repeating over and over again, with their respective targeted methods.

main/java/org/checkerframework/javacutil/BasicAnnotationProvider.java:13: error: cannot find symbol
            boolean found = AnnotationUtils.areSameByName(am, "org.checkerframework.dataflow.qual.SideEffectFree");
                            ^
  symbol:   variable AnnotationUtils
  location: class BasicAnnotationProvider
1 error

Please find below the Specimin statistics from javacutil:

Running Specimin on directory: /path/to/checker-framework/javacutil/src
Attempted minimization - 533:
Successfully minimized 279 (52.35%) target methods.
Failed to minimize 254 (47.65%) target methods.

Attempted compilation - 279:
Successful: 154 (55.20%)
Failed: 125 (44.80%)

Fully successful from minimization to compilation: 154 (28.89%)

I am not certain the exact number (I can get that to you if necessary), but from going through the logs, many of the failed minimizations are from error: cannot find symbol.

This issue I created seems to be 2 separate issues, one of which you already addressed.