Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix methods of lint and warning see #131 (comment)
Signed-off-by: olivier lamy <olamy@apache.org>
  • Loading branch information
olamy committed Apr 29, 2021
commit e09f8bce92fcf8a84ab8a8b9bcfc95654ea491fe
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public class CompilerConfiguration
private boolean showWarnings = true;

private String warnings;

private boolean showLint;

/**
* -Werror argument as supported since Java 1.7
Expand Down Expand Up @@ -341,16 +343,21 @@ public String getDebugLevel()
return debugLevel;
}

public void setShowWarnings( boolean showWarnings )
public void setWarnings( String warnings )
{
this.showWarnings = showWarnings;
this.warnings = warnings;
}

public boolean isShowWarnings()
{
return showWarnings;
}

public void setShowWarnings( boolean showWarnings )
{
this.showWarnings = showWarnings;
}

public boolean isShowDeprecation()
{
return showDeprecation;
Expand All @@ -361,9 +368,16 @@ public String getWarnings()
return warnings;
}

public void setShowLint( String warnings )


public void setShowLint( boolean showLint )
{
this.warnings = warnings;
this.showLint = showLint;
}

public boolean isShowLint()
{
return this.showLint;
}

public void setShowDeprecation( boolean showDeprecation )
Expand Down
1 change: 1 addition & 0 deletions plexus-compiler-its/src/main/it/simple-javac/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<configuration>
<target>8</target>
<source>8</source>
<!-- <showLint>true</showLint>-->
<compilerArgs>
<compilerArg>-Xlint:-path</compilerArg>
</compilerArgs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,20 @@ public static String[] buildCompilerArguments( CompilerConfiguration config, Str
if ( !config.isShowWarnings() )
{
args.add( "-nowarn" );
} else
}
else
{
String warnings = config.getWarnings();
if (StringUtils.isNotEmpty(warnings))
if (config.isShowLint())
{
args.add("-Xlint:" + warnings);
if(config.isShowWarnings() && StringUtils.isNotEmpty(warnings))
{
args.add( "-Xlint:" + warnings );
}
else
{
args.add( "-Xlint" );
}
}
}

Expand Down