Skip to content

Eclipse compiler does not process multiple --add-exports correctly #111

Closed
@eilensm

Description

@eilensm

Hi,

I experienced a problem with mulitple --add-exports during my Maven build and created an issue in the Maven compiler plugin (see https://issues.apache.org/jira/browse/MCOMPILER-279).
Since the plugin works with the normal Java compiler and also the Eclipse compiler itself understands multiple add-exports arguments, he pointed me to the EclipseJavaCompiler here.

The problem is that in line https://github.com/codehaus-plexus/plexus-compiler/blob/master/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java#L179, the custom compiler arguments are processed as entries of a map. But here, the entries should be processed as real entry pairs. Therefore the method config.getCustomCompilerArgumentsEntries() should be used. But there is also a failing test thus a further change becomes necessary. Thus the change for line #179 would be following:

for ( Entry<String, String> entry : config.getCustomCompilerArgumentsEntries() )
{
    // omit errorsAsWarnings options which already have been handled above
    if ( entry.getKey().equals("errorsAsWarnings") || entry.getKey().equals("-errorsAsWarnings") )
    {
	    continue;
    }

I don't know exactly how to provide a patch or a pull request and I'm totally unsure of how to provide a unit test verifying the correct behaviour after the fix. I had a look at the existing unit tests but didn't find anything I could really base a new test case upon.

But I would give a PR a try if someone can point me to a howto, etc....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions