File tree 6 files changed +47
-0
lines changed
retrolambda/src/main/java/net/orfjackal/retrolambda
retrolambda-api/src/main/java/net/orfjackal/retrolambda/api
retrolambda-maven-plugin/src/main/java/net/orfjackal/retrolambda/maven
6 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,11 @@ Configurable system properties:
131
131
Alternative to retrolambda.classpath for avoiding the command line
132
132
length limit. The file must list one file per line with UTF-8 encoding.
133
133
134
+ retrolambda.fixJava8Classpath
135
+ Whether to replace occurrences of classpath entries ending in /classes
136
+ with entries ending in /classes-java8 if such directory is available.
137
+ Disabled by default. Enable by setting to "true"
138
+
134
139
retrolambda.includedFiles
135
140
List of files to process, instead of processing all files.
136
141
This is useful for a build tool to support incremental compilation.
Original file line number Diff line number Diff line change @@ -17,4 +17,5 @@ public class RetrolambdaApi {
17
17
public static final String DEFAULT_METHODS = PREFIX + "defaultMethods" ;
18
18
public static final String BYTECODE_VERSION = PREFIX + "bytecodeVersion" ;
19
19
public static final String JAVAC_HACKS = PREFIX + "javacHacks" ;
20
+ public static final String FIX_JAVA8_CLASSPATH = PREFIX + "fixJava8Classpath" ;
20
21
}
Original file line number Diff line number Diff line change @@ -107,6 +107,14 @@ abstract class ProcessClassesMojo extends AbstractMojo {
107
107
@ Parameter (defaultValue = "false" )
108
108
public boolean fork ;
109
109
110
+ /**
111
+ * Whether to replace occurrences of classpath entries ending in {@code /classes}
112
+ * with entries ending in {@code /classes-java8} if such directory is available.
113
+ * @since 2.5.8
114
+ */
115
+ @ Parameter (defaultValue = "false" , property = "fixJava8Classpath" , required = false )
116
+ public boolean fixJava8Classpath ;
117
+
110
118
protected abstract File getInputDir ();
111
119
112
120
protected abstract File getOutputDir ();
@@ -126,6 +134,7 @@ public void execute() throws MojoExecutionException {
126
134
config .setProperty (RetrolambdaApi .OUTPUT_DIR , getOutputDir ().getAbsolutePath ());
127
135
config .setProperty (RetrolambdaApi .CLASSPATH , getClasspath ());
128
136
config .setProperty (RetrolambdaApi .JAVAC_HACKS , "" + javacHacks );
137
+ config .setProperty (RetrolambdaApi .FIX_JAVA8_CLASSPATH , "" + fixJava8Classpath );
129
138
130
139
if (fork ) {
131
140
processClassesInForkedProcess (config );
Original file line number Diff line number Diff line change @@ -24,4 +24,6 @@ public interface Config {
24
24
boolean isJavacHacksEnabled ();
25
25
26
26
boolean isQuiet ();
27
+
28
+ boolean isFixJava8Classpath ();
27
29
}
Original file line number Diff line number Diff line change @@ -38,6 +38,21 @@ public static void run(Config config) throws Throwable {
38
38
} else {
39
39
Log .INFO ();
40
40
}
41
+
42
+ if (config .isFixJava8Classpath ()) {
43
+ List <Path > classpathNew = new ArrayList <>();
44
+ for (Path p : classpath ) {
45
+ if (p .toString ().endsWith ("/classes" ) && Files .isDirectory (p )) {
46
+ Path p2 = p .getParent ().resolve ("classes-java8" );
47
+ if (Files .isDirectory (p2 )) {
48
+ p = p2 ;
49
+ }
50
+ }
51
+ classpathNew .add (p );
52
+ }
53
+ classpath = classpathNew ;
54
+ }
55
+
41
56
Log .info ("Bytecode version: " + bytecodeVersion + " (" + Bytecode .getJavaVersion (bytecodeVersion ) + ")" );
42
57
Log .info ("Default methods: " + defaultMethodsEnabled );
43
58
Log .info ("Input directory: " + inputDir );
@@ -47,6 +62,7 @@ public static void run(Config config) throws Throwable {
47
62
Log .info ("JVM version: " + System .getProperty ("java.version" ));
48
63
Log .info ("Agent enabled: " + Agent .isEnabled ());
49
64
Log .info ("javac hacks: " + isJavacHacksEnabled );
65
+ Log .info ("Fix classpath: " + config .isFixJava8Classpath ());
50
66
51
67
if (!Files .isDirectory (inputDir )) {
52
68
Log .info ("Nothing to do; not a directory: " + inputDir );
Original file line number Diff line number Diff line change @@ -132,6 +132,20 @@ public Path getOutputDir() {
132
132
"length limit. The file must list one file per line with UTF-8 encoding." );
133
133
}
134
134
135
+
136
+ // fix Java 8 classpath
137
+
138
+ static {
139
+ optionalParameterHelp (FIX_JAVA8_CLASSPATH ,
140
+ "Whether to replace occurrences of classpath entries ending in /classes" ,
141
+ "with entries ending in /classes-java8 if such directory is available." ,
142
+ "Disabled by default. Enable by setting to \" true\" " );
143
+ }
144
+
145
+ @ Override
146
+ public boolean isFixJava8Classpath () {
147
+ return Boolean .parseBoolean (p .getProperty (FIX_JAVA8_CLASSPATH , "false" ));
148
+ }
135
149
@ Override
136
150
public List <Path > getClasspath () {
137
151
String classpath = p .getProperty (CLASSPATH );
You can’t perform that action at this time.
0 commit comments