Skip to content

add workaround to jdk bug https://bugs.openjdk.java.net/browse/JDK-8210649 found via https://issues.apache.org/jira/browse/MCOMPILER-346 add IT test from https://github.com/basil/MCOMPILER-346-mre #196

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 6 commits into from
Mar 6, 2022

Conversation

olamy
Copy link
Member

@olamy olamy commented Mar 6, 2022

Signed-off-by: Olivier Lamy olamy@apache.org

olamy added 4 commits March 6, 2022 10:48
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
… it as it was not extensible here... :)

Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
@@ -111,14 +112,14 @@ public CompilerResult compileInProcess( String[] args, final CompilerConfigurati
CompilerMessage.Kind.ERROR );
return new CompilerResult( false, Collections.singletonList( message ) );
}
final String sourceEncoding = config.getSourceEncoding();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup removing useless final

@@ -57,7 +58,7 @@ protected JavaCompiler newJavaCompiler()
return ToolProvider.getSystemJavaCompiler();
}

private List<JavaCompiler> JAVA_COMPILERS = new CopyOnWriteArrayList<>();
private final List<JavaCompiler> JAVA_COMPILERS = new CopyOnWriteArrayList<>();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a class field used in a synchronized block, this is the place where final is important and it was not there


public interface InProcessCompiler {
public interface InProcessCompiler extends LogEnabled {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change that to be able to get logger.
The only usage of this in project is a manual construction of the only implementation available here and I bump version number.

import java.util.concurrent.CopyOnWriteArrayList;

/**
* @author Olivier Lamy
* @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
* @since 2.0
*/
@Component( role = Compiler.class )
public class JavaxToolsCompiler implements InProcessCompiler
@Component( role = InProcessCompiler.class )
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a change but fix a bug to be able to use dependency injection for this...
it was simply wrong for very long but the only usage was new JavaxToolsCompiler() :)

@olamy olamy merged commit ea3680f into master Mar 6, 2022
@olamy olamy deleted the workaround-jdk-bug-MCOMPILER-346-mre branch March 6, 2022 04:32
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant