Skip to content
Commits on Source (8)
plexus-compiler (2.8.4-1) unstable; urgency=medium
* Team upload.
* New upstream release
* Automatically set the value of the javac --release attribute to improve
the backward compatibility of the code compiled with Java 9 or later
(Closes: #895619)
* Depend on libecj-java (>= 3.13.2) and removed the ecj compatibility patch
* Standards-Version updated to 4.1.4
* Use salsa.debian.org Vcs-* URLs
-- Emmanuel Bourg <ebourg@apache.org> Sat, 16 Jun 2018 00:09:15 +0200
plexus-compiler (2.8.3-1) unstable; urgency=medium
* Team upload.
......
......@@ -11,7 +11,7 @@ Build-Depends:
default-jdk-doc,
junit4,
libcommons-lang-java (>= 2.0),
libecj-java,
libecj-java (>= 3.13.2),
libmaven-javadoc-plugin-java,
libmaven3-core-java,
libplexus-component-metadata-java,
......@@ -19,9 +19,9 @@ Build-Depends:
libplexus-utils2-java,
libplexus-utils2-java-doc,
maven-debian-helper (>= 1.5)
Standards-Version: 4.1.3
Vcs-Git: https://anonscm.debian.org/git/pkg-java/plexus-compiler.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/plexus-compiler.git
Standards-Version: 4.1.4
Vcs-Git: https://salsa.debian.org/java-team/plexus-compiler.git
Vcs-Browser: https://salsa.debian.org/java-team/plexus-compiler
Homepage: https://codehaus-plexus.github.io/plexus-compiler/
Package: libplexus-compiler-java
......
......@@ -3,8 +3,61 @@ Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java
+++ b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java
@@ -339,12 +339,20 @@
@@ -195,6 +195,18 @@
}
}
+ protected static boolean isJava9()
+ {
+ try
+ {
+ return Float.valueOf( System.getProperty( "java.class.version", "0" ) ).intValue() >= 53;
+ }
+ catch ( Exception e )
+ {
+ return false;
+ }
+ }
+
public String[] createCommandLine( CompilerConfiguration config )
throws CompilerException
{
@@ -337,14 +349,54 @@
args.add( "--release" );
args.add( config.getReleaseVersion() );
}
+ else if ( isJava9() )
+ {
+ List<String> unsupportedLanguageLevels = java.util.Arrays.asList(new String[]{"1.1", "1.2", "1.3", "1.4", "1.5", "5", "1.6", "6"});
+
+ String source = config.getSourceVersion();
+ String target = config.getTargetVersion();
+ String release = null;
+
+ if ( !StringUtils.isEmpty( target ) && !unsupportedLanguageLevels.contains( target ) )
+ {
+ System.err.println( "Release parameter not specified, defaulting to the value of the target parameter (" + target + ")" );
+ release = target;
+ }
+ else if ( !StringUtils.isEmpty( source ) && !unsupportedLanguageLevels.contains( source ) )
+ {
+ System.err.println( "Release parameter not specified, defaulting to the value of the source parameter (" + source + ")" );
+ release = source;
+ }
+ else
+ {
+ release = "7";
+ System.err.println( "Release parameter not specified, defaulting to the minimum supported value (" + release + ")" );
+ }
+
+ if ( release.startsWith( "1." ))
+ {
+ release = release.substring( 2 );
+ }
+
+ args.add( "--release" );
+ args.add( release );
+ }
else
{
+ List<String> unsupportedLanguageLevels = java.util.Arrays.asList(new String[]{"1.1", "1.2", "1.3", "1.4", "1.5", "5"});
......@@ -25,7 +78,7 @@ Forwarded: not-needed
}
else
{
@@ -356,7 +364,13 @@
@@ -356,7 +408,13 @@
{
// If omitted, later JDKs complain about a 1.1 target
args.add( "-source" );
......
Description: Fixes the compatibility with the version of ECJ in Debian
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java
+++ b/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java
@@ -348,7 +348,7 @@
}
else if ( "9".equals( versionSpec ) )
{
- return CompilerOptions.VERSION_9;
+ return CompilerOptions.VERSION_1_9;
}
else
{
......@@ -2,4 +2,3 @@ fix_test_classpath.patch
auto-adjust-language-level.patch
maven-compatibility.patch
missing-dependency-management-entries.patch
ecj-compatibility.patch
......@@ -2,6 +2,3 @@
%:
dh $@
get-orig-source:
uscan --download-current-version --force-download --rename
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler</artifactId>
<version>2.8.3</version>
<version>2.8.4</version>
</parent>
<artifactId>plexus-compiler-api</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler</artifactId>
<version>2.8.3</version>
<version>2.8.4</version>
</parent>
<artifactId>plexus-compiler-manager</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler</artifactId>
<version>2.8.3</version>
<version>2.8.4</version>
</parent>
<artifactId>plexus-compiler-test</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compilers</artifactId>
<version>2.8.3</version>
<version>2.8.4</version>
</parent>
<artifactId>plexus-compiler-aspectj</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compilers</artifactId>
<version>2.8.3</version>
<version>2.8.4</version>
</parent>
<artifactId>plexus-compiler-csharp</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compilers</artifactId>
<version>2.8.3</version>
<version>2.8.4</version>
</parent>
<artifactId>plexus-compiler-eclipse</artifactId>
......
package org.codehaus.plexus.compiler.eclipse;
import org.codehaus.plexus.compiler.CompilerMessage;
import org.codehaus.plexus.compiler.CompilerMessage.Kind;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
/**
* @author <a href="mailto:jal@etc.to">Frits Jalvingh</a>
* Created on 31-3-18.
*/
public class EcjResponseParser {
/*--------------------------------------------------------------*/
/* CODING: Decode ECJ -log format results. */
/*--------------------------------------------------------------*/
/**
* Scan the specified response file for compilation messages.
*/
public List<CompilerMessage> parse(File xmltf, boolean errorsAsWarnings) throws Exception {
//if(xmltf.length() < 80)
// return;
List<CompilerMessage> list = new ArrayList<>();
XMLInputFactory xmlif = getStreamFactory();
try(Reader src = new BufferedReader(new InputStreamReader(new FileInputStream(xmltf), "utf-8"))) {
XMLStreamReader xsr = xmlif.createXMLStreamReader(src);
// scan for "source" elements, skip all else.
while(xsr.hasNext()) {
int type = xsr.next();
if(type == XMLStreamConstants.START_ELEMENT && "source".equals(xsr.getLocalName())) {
decodeSourceElement(list, xsr, errorsAsWarnings);
}
}
}
return list;
}
private void decodeSourceElement(List<CompilerMessage> list, XMLStreamReader xsr, boolean errorsAsWarnings) throws Exception {
String filename = xsr.getAttributeValue(null, "path");
//-- Got a file- call handler
File path = new File(filename).getCanonicalFile();
while(xsr.hasNext()) {
int type = xsr.nextTag();
if(type == XMLStreamConstants.START_ELEMENT) {
if("problems".equals(xsr.getLocalName())) {
decodeProblems(list, path.toString(), xsr, errorsAsWarnings);
} else
ignoreTillEnd(xsr);
} else if(type == XMLStreamConstants.END_ELEMENT) {
return;
}
}
}
/**
* Locate "problem" nodes.
*/
private void decodeProblems(List<CompilerMessage> list, String sourcePath, XMLStreamReader xsr, boolean errorsAsWarnings) throws Exception {
while(xsr.hasNext()) {
int type = xsr.nextTag();
if(type == XMLStreamConstants.START_ELEMENT) {
if("problem".equals(xsr.getLocalName())) {
decodeProblem(list, sourcePath, xsr, errorsAsWarnings);
} else
ignoreTillEnd(xsr);
} else if(type == XMLStreamConstants.END_ELEMENT) {
return;
}
}
}
private void decodeProblem(List<CompilerMessage> list, String sourcePath, XMLStreamReader xsr, boolean errorsAsWarnings) throws Exception {
String id = xsr.getAttributeValue(null, "optionKey"); // Key for the problem
int startline = getInt(xsr, "line");
int column = getInt(xsr, "charStart");
int endCol = getInt(xsr, "charEnd");
String sev = xsr.getAttributeValue(null, "severity");
String message = "Unknown message?";
//-- Go watch for "message"
while(xsr.hasNext()) {
int type = xsr.nextTag();
if(type == XMLStreamConstants.START_ELEMENT) {
if("message".equals(xsr.getLocalName())) {
message = xsr.getAttributeValue(null, "value");
}
ignoreTillEnd(xsr);
} else if(type == XMLStreamConstants.END_ELEMENT) {
break;
}
}
Kind msgtype;
if("warning".equalsIgnoreCase(sev))
msgtype = Kind.WARNING;
else if("error".equalsIgnoreCase(sev))
msgtype = errorsAsWarnings ? Kind.WARNING : Kind.ERROR;
else if("info".equalsIgnoreCase(sev))
msgtype = Kind.NOTE;
else {
msgtype = Kind.OTHER;
}
CompilerMessage cm = new CompilerMessage(sourcePath, msgtype, startline, column, startline, endCol, message);
list.add(cm);
}
private static void ignoreTillEnd(XMLStreamReader xsr) throws Exception {
int depth = 1;
while(xsr.hasNext()) {
int type = xsr.next();
if(type == XMLStreamConstants.START_ELEMENT) {
depth++;
} else if(type == XMLStreamConstants.END_ELEMENT) {
depth--;
if(depth == 0)
return;
}
}
}
private static int getInt(XMLStreamReader xsr, String name) throws IOException {
String v = xsr.getAttributeValue(null, name);
if(null == v)
return -1;
try {
return Integer.parseInt(v.trim());
} catch(Exception x) {
throw new IOException("Illegal integer value '" + v + "' in attribute " + name);
}
}
static private XMLInputFactory getStreamFactory() {
XMLInputFactory xmlif = XMLInputFactory.newInstance();
xmlif.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
xmlif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
xmlif.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
return xmlif;
}
}
package org.codehaus.plexus.compiler.eclipse;
import java.util.Arrays;
import java.util.Collection;
import org.codehaus.plexus.compiler.AbstractCompilerTest;
import org.codehaus.plexus.compiler.CompilerConfiguration;
import java.util.Arrays;
import java.util.Collection;
public class EclipseCompilerErrorsAsWarningsTest extends AbstractCompilerTest
{
......@@ -39,9 +39,14 @@ public class EclipseCompilerErrorsAsWarningsTest extends AbstractCompilerTest
protected Collection<String> expectedOutputFiles()
{
return Arrays.asList( new String[] { "org/codehaus/foo/Deprecation.class",
"org/codehaus/foo/ExternalDeps.class", "org/codehaus/foo/Person.class",
"org/codehaus/foo/ReservedWord.class", "org/codehaus/foo/Bad.class",
"org/codehaus/foo/UnknownSymbol.class", "org/codehaus/foo/RightClassname.class" } );
return Arrays.asList( new String[] {
"org/codehaus/foo/Deprecation.class",
"org/codehaus/foo/ExternalDeps.class",
"org/codehaus/foo/Person.class",
"org/codehaus/foo/ReservedWord.class",
//"org/codehaus/foo/Bad.class", // This one has no class file generated as it's one big issue
//"org/codehaus/foo/UnknownSymbol.class",
//"org/codehaus/foo/RightClassname.class"
});
}
}
......@@ -24,14 +24,13 @@ package org.codehaus.plexus.compiler.eclipse;
* SOFTWARE.
*/
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import org.codehaus.plexus.compiler.AbstractCompilerTest;
import org.codehaus.plexus.compiler.Compiler;
import org.codehaus.plexus.compiler.CompilerConfiguration;
import java.util.Arrays;
import java.util.Collection;
/**
* @author <a href="mailto:jason@plexus.org">Jason van Zyl</a>
*/
......@@ -82,25 +81,6 @@ public class EclipseCompilerTest
compiler.performCompile( compilerConfig );
}
public void testCustomArgumentCleanup()
{
EclipseJavaCompiler compiler = new EclipseJavaCompiler();
CompilerConfiguration compilerConfig = createMinimalCompilerConfig();
compilerConfig.addCompilerCustomArgument( "-key", "value" );
compilerConfig.addCompilerCustomArgument( "cleanKey", "value" );
Map<String, String> cleaned = compiler.cleanKeyNames( compilerConfig.getCustomCompilerArgumentsAsMap() );
assertTrue( "Key should have been cleaned", cleaned.containsKey( "key" ) );
assertFalse( "Key should have been cleaned", cleaned.containsKey( "-key" ) );
assertTrue( "This key should not have been cleaned does not start with dash", cleaned.containsKey( "cleanKey" ) );
}
public void testInitializeWarningsForPropertiesArgument()
throws Exception
{
......@@ -117,7 +97,7 @@ public class EclipseCompilerTest
}
catch ( IllegalArgumentException e )
{
assertEquals( "Properties file not exist", e.getMessage() );
assertTrue("Message must start with 'Properties file'", e.getMessage().startsWith("Properties file"));
}
}
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compilers</artifactId>
<version>2.8.3</version>
<version>2.8.4</version>
</parent>
<artifactId>plexus-compiler-j2objc</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compilers</artifactId>
<version>2.8.3</version>
<version>2.8.4</version>
</parent>
<artifactId>plexus-compiler-javac-errorprone</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compilers</artifactId>
<version>2.8.3</version>
<version>2.8.4</version>
</parent>
<artifactId>plexus-compiler-javac</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compilers</artifactId>
<version>2.8.3</version>
<version>2.8.4</version>
</parent>
<artifactId>plexus-compiler-jikes</artifactId>
......