@@ -405,30 +405,32 @@ protected Plugin.Engine.Summary transform(List<? extends String> classPath,
405405 String managed = coordinates .get (new Coordinate (project .getGroupId (), project .getArtifactId ()));
406406 EntryPoint entryPoint = (initialization == null ? new Initialization () : initialization ).getEntryPoint (classLoaderResolver , project .getGroupId (), project .getArtifactId (), managed == null ? project .getVersion () : managed , project .getPackaging ());
407407 getLog ().info ("Resolved entry point: " + entryPoint );
408+ String javaVersionString = findJavaVersionString (project , "release" );
409+ if (javaVersionString == null ) {
410+ javaVersionString = findJavaVersionString (project , "target" );
411+ }
412+ ClassFileVersion classFileVersion ;
413+ if (javaVersionString == null ) {
414+ classFileVersion = ClassFileVersion .ofThisVm (ClassFileVersion .JAVA_V5 );
415+ getLog ().warn ("Could not locate Java target version, build is JDK dependant: " + classFileVersion .getMajorVersion ());
416+ } else {
417+ classFileVersion = ClassFileVersion .ofJavaVersionString (javaVersionString );
418+ getLog ().debug ("Java version detected: " + javaVersionString );
419+ }
408420 List <ClassFileLocator > classFileLocators = new ArrayList <ClassFileLocator >(classPath .size ());
409421 classFileLocators .add (ClassFileLocator .ForClassLoader .ofPlatformLoader ());
410422 for (String element : classPath ) {
411423 File artifact = new File (element );
412- classFileLocators .add (artifact .isFile () ? ClassFileLocator .ForJarFile .of (artifact ) : new ClassFileLocator .ForFolder (artifact ));
424+ classFileLocators .add (artifact .isFile ()
425+ ? ClassFileLocator .ForJarFile .of (artifact , classFileVersion )
426+ : ClassFileLocator .ForFolder .of (artifact , classFileVersion ));
413427 }
414428 ClassFileLocator classFileLocator = new ClassFileLocator .Compound (classFileLocators );
415429 Plugin .Engine .Summary summary ;
416430 try {
417431 getLog ().info ("Processing class files located in in: " + file );
418432 Plugin .Engine pluginEngine ;
419433 try {
420- String javaVersionString = findJavaVersionString (project , "release" );
421- if (javaVersionString == null ) {
422- javaVersionString = findJavaVersionString (project , "target" );
423- }
424- ClassFileVersion classFileVersion ;
425- if (javaVersionString == null ) {
426- classFileVersion = ClassFileVersion .ofThisVm (ClassFileVersion .JAVA_V5 );
427- getLog ().warn ("Could not locate Java target version, build is JDK dependant: " + classFileVersion .getMajorVersion ());
428- } else {
429- classFileVersion = ClassFileVersion .ofJavaVersionString (javaVersionString );
430- getLog ().debug ("Java version detected: " + javaVersionString );
431- }
432434 pluginEngine = Plugin .Engine .Default .of (entryPoint ,
433435 classFileVersion ,
434436 suffix == null || suffix .length () == 0 ? MethodNameTransformer .Suffixing .withRandomSuffix () : new MethodNameTransformer .Suffixing (suffix ));
@@ -439,6 +441,7 @@ protected Plugin.Engine.Summary transform(List<? extends String> classPath,
439441 summary = pluginEngine
440442 .with (extendedParsing ? Plugin .Engine .PoolStrategy .Default .EXTENDED : Plugin .Engine .PoolStrategy .Default .FAST )
441443 .with (classFileLocator )
444+ .with (classFileVersion )
442445 .with (new TransformationLogger (getLog ()))
443446 .withErrorHandlers (Plugin .Engine .ErrorHandler .Enforcing .ALL_TYPES_RESOLVED ,
444447 failOnLiveInitializer ? Plugin .Engine .ErrorHandler .Enforcing .NO_LIVE_INITIALIZERS : Plugin .Engine .Listener .NoOp .INSTANCE ,
0 commit comments