njit-jerse / specimin

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

issue jdk-8319461 #234

Closed tahiat closed 3 months ago

tahiat commented 3 months ago

./gradlew run --args='--outputDirectory "../ISSUES/jdk-8319461/output/" --root "../ISSUES/jdk-8319461/property/core/src/main/java/" --targetFile "io/github/mmm/property/factory/PropertyFactoryManager.java" --targetMethod "io.github.mmm.property.factory#create(Class<P>, Class<V>, String ,PropertyMetadata<V>)"'

target source: script on this https://github.com/tahiat/property.git

Exception in thread "main" com.github.javaparser.ParseProblemException: (line 89,col 9) Use of patterns with instanceof is not supported.

    at com.github.javaparser.StaticJavaParser.handleResult(StaticJavaParser.java:270)
    at com.github.javaparser.StaticJavaParser.parse(StaticJavaParser.java:167)
    at org.checkerframework.specimin.SpeciminRunner.parseJavaFile(SpeciminRunner.java:475)
    at org.checkerframework.specimin.SpeciminRunner.performMinimization(SpeciminRunner.java:115)
    at org.checkerframework.specimin.SpeciminRunner.main(SpeciminRunner.java:76)
LoiNguyenCS commented 3 months ago

I will look into this problem.

LoiNguyenCS commented 3 months ago

Hi @tahiat,

In PropertyFactoryManager.java, at line 90, you will need to make a small change.

This is the original codes:

if (factory instanceof AbstractSimplePropertyFactory simpleFactory) { // avoid creating PropertyTypeInfo if not used... return (P) simpleFactory.create(name, metadata); }

You need to change it to:

if (factory instanceof AbstractSimplePropertyFactory) { AbstractSimplePropertyFactory simpleFactory = ((AbstractSimplePropertyFactory) factory); // avoid creating PropertyTypeInfo if not used... return (P) simpleFactory.create(name, metadata); }

What the original codes use is called Pattern Matching for instanceof, which is not supported by JavaParser.

After you have done so, you will encounter an infinite loop when trying to run Specimin. That infinite loop should be fixed by #238 .

LoiNguyenCS commented 3 months ago

Resolved by #238.