Skip to content

usage of reflection is not needed anymore #140

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecution;
Expand Down Expand Up @@ -1496,7 +1497,7 @@ private Set<File> getCompileSources( Compiler compiler, CompilerConfiguration co
catch ( InclusionScanException e )
{
throw new MojoExecutionException(
"Error scanning source root: \'" + sourceRoot + "\' for stale files to recompile.", e );
"Error scanning source root: '" + sourceRoot + "' for stale files to recompile.", e );
}
}

Expand Down Expand Up @@ -1536,42 +1537,14 @@ private boolean isSourceChanged( CompilerConfiguration compilerConfiguration, Co
*/
protected int getRequestThreadCount()
{
try
{
Method getRequestMethod = session.getClass().getMethod( "getRequest" );
Object mavenExecutionRequest = getRequestMethod.invoke( this.session );
Method getThreadCountMethod = mavenExecutionRequest.getClass().getMethod( "getThreadCount" );
String threadCount = (String) getThreadCountMethod.invoke( mavenExecutionRequest );
return Integer.parseInt( threadCount );
}
catch ( Exception e )
{
getLog().debug( "unable to get threadCount for the current build: " + e.getMessage() );
}
return 1;
return session.getRequest().getDegreeOfConcurrency();
}

protected Date getBuildStartTime()
{
Date buildStartTime = null;
try
{
Method getRequestMethod = session.getClass().getMethod( "getRequest" );
Object mavenExecutionRequest = getRequestMethod.invoke( session );
Method getStartTimeMethod = mavenExecutionRequest.getClass().getMethod( "getStartTime" );
buildStartTime = (Date) getStartTimeMethod.invoke( mavenExecutionRequest );
}
catch ( Exception e )
{
getLog().debug( "unable to get start time for the current build: " + e.getMessage() );
}

if ( buildStartTime == null )
{
return new Date();
}

return buildStartTime;
MavenExecutionRequest request = session.getRequest();
Date buildStartTime = request == null ? new Date() : request.getStartTime();
return buildStartTime == null ? new Date() : buildStartTime;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,15 @@ protected void preparePaths( Set<File> sourceFiles )

if ( release != null )
{
if ( Integer.valueOf( release ) < 9 )
if ( Integer.parseInt( release ) < 9 )
{
pathElements = Collections.emptyMap();
modulepathElements = Collections.emptyList();
classpathElements = testPath;
return;
}
}
else if ( Double.valueOf( getTarget() ) < Double.valueOf( MODULE_INFO_TARGET ) )
else if ( Double.parseDouble( getTarget() ) < Double.parseDouble( MODULE_INFO_TARGET ) )
{
pathElements = Collections.emptyMap();
modulepathElements = Collections.emptyList();
Expand Down Expand Up @@ -440,7 +440,7 @@ protected SourceInclusionScanner getSourceInclusionScanner( String inputFileEndi
if ( testIncludes.isEmpty() && testExcludes.isEmpty() )
{
testIncludes = Collections.singleton( defaultIncludePattern );
scanner = new SimpleSourceInclusionScanner( testIncludes, Collections.<String>emptySet() );
scanner = new SimpleSourceInclusionScanner( testIncludes, Collections.emptySet() );
}
else
{
Expand Down