Skip to content

Commit 3300ad4

Browse files
authored
Use plexus annotations rather than doclet to fix javadoc with java11 (#90)
* test javadoc as part of the build Signed-off-by: olivier lamy <olamy@apache.org> * fix javadoc by using annotations rather than doclet format code Signed-off-by: olivier lamy <olamy@apache.org> * project still java7 Signed-off-by: olivier lamy <olamy@apache.org> * java 8 needed Signed-off-by: olivier lamy <olamy@apache.org>
1 parent 27222bf commit 3300ad4

File tree

23 files changed

+636
-440
lines changed

23 files changed

+636
-440
lines changed

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ jobs:
4949
java-version: ${{ matrix.java }}
5050

5151
- name: Build with Maven
52-
run: mvn install -e -B -V -Pno-tests-if-not-on-osx
52+
run: mvn install javadoc:javadoc -e -B -V -Pno-tests-if-not-on-osx

plexus-compiler-manager/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@
1717
<groupId>org.codehaus.plexus</groupId>
1818
<artifactId>plexus-compiler-api</artifactId>
1919
</dependency>
20+
<dependency>
21+
<groupId>org.codehaus.plexus</groupId>
22+
<artifactId>plexus-component-annotations</artifactId>
23+
</dependency>
2024
</dependencies>
2125
</project>

plexus-compiler-manager/src/main/java/org/codehaus/plexus/compiler/manager/DefaultCompilerManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@
2525
*/
2626

2727
import org.codehaus.plexus.compiler.Compiler;
28+
import org.codehaus.plexus.component.annotations.Component;
29+
import org.codehaus.plexus.component.annotations.Requirement;
2830
import org.codehaus.plexus.logging.AbstractLogEnabled;
2931

3032
import java.util.Map;
3133

3234
/**
3335
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
34-
* @plexus.component
3536
*/
37+
@Component( role = CompilerManager.class )
3638
public class DefaultCompilerManager
3739
extends AbstractLogEnabled
3840
implements CompilerManager
3941
{
40-
/**
41-
* @plexus.requirement role="org.codehaus.plexus.compiler.Compiler"
42-
*/
42+
@Requirement
4343
private Map<String, Compiler> compilers;
4444

4545
// ----------------------------------------------------------------------

plexus-compilers/plexus-compiler-aspectj/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
</properties>
1919

2020
<dependencies>
21+
<dependency>
22+
<groupId>org.codehaus.plexus</groupId>
23+
<artifactId>plexus-component-annotations</artifactId>
24+
</dependency>
2125
<dependency>
2226
<groupId>org.aspectj</groupId>
2327
<artifactId>aspectjrt</artifactId>

plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompiler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
1111
import org.aspectj.tools.ajc.Main;
1212
import org.codehaus.plexus.compiler.AbstractCompiler;
13+
import org.codehaus.plexus.compiler.Compiler;
1314
import org.codehaus.plexus.compiler.CompilerConfiguration;
1415
import org.codehaus.plexus.compiler.CompilerException;
1516
import org.codehaus.plexus.compiler.CompilerMessage;
1617
import org.codehaus.plexus.compiler.CompilerOutputStyle;
1718
import org.codehaus.plexus.compiler.CompilerResult;
19+
import org.codehaus.plexus.component.annotations.Component;
1820

1921
import java.io.File;
2022
import java.io.IOException;
@@ -281,8 +283,8 @@
281283
* </p>
282284
*
283285
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
284-
* @plexus.component role="org.codehaus.plexus.compiler.Compiler" role-hint="aspectj"
285286
*/
287+
@Component( role = Compiler.class, hint = "aspectj")
286288
public class AspectJCompiler
287289
extends AbstractCompiler
288290
{

plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerConfiguration.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ public class AspectJCompilerConfiguration
1717
extends CompilerConfiguration
1818
{
1919

20-
private List<String> aspectPath = new LinkedList<String>();
20+
private List<String> aspectPath = new LinkedList<>();
2121

22-
private List<String> inJars = new LinkedList<String>();
22+
private List<String> inJars = new LinkedList<>();
2323

24-
private List<String> inPath = new LinkedList<String>();
24+
private List<String> inPath = new LinkedList<>();
2525

2626
private String outputJar;
2727

28-
private Map<String, String> ajOptions = new TreeMap<String, String>();
28+
private Map<String, String> ajOptions = new TreeMap<>();
2929

3030
private Map<String, File> sourcePathResources;
3131

3232
public void setAspectPath( List<String> aspectPath )
3333
{
34-
this.aspectPath = new LinkedList<String>( aspectPath );
34+
this.aspectPath = new LinkedList<>( aspectPath );
3535
}
3636

3737
public void addAspectPath( String aspectPath )
@@ -46,7 +46,7 @@ public List<String> getAspectPath()
4646

4747
public void setInJars( List<String> inJars )
4848
{
49-
this.inJars = new LinkedList<String>( inJars );
49+
this.inJars = new LinkedList<>( inJars );
5050
}
5151

5252
public void addInJar( String inJar )
@@ -61,7 +61,7 @@ public List<String> getInJars()
6161

6262
public void setInPath( List<String> inPath )
6363
{
64-
this.inPath = new LinkedList<String>( inPath );
64+
this.inPath = new LinkedList<>( inPath );
6565
}
6666

6767
public void addInPath( String inPath )
@@ -86,7 +86,6 @@ public String getOutputJar()
8686

8787
/**
8888
* Ignored, not supported yet
89-
* @param ajOptions
9089
*/
9190
public void setAJOptions( Map<String, String> ajOptions )
9291
{
@@ -118,4 +117,4 @@ public Map<String, File> getSourcePathResources()
118117
return sourcePathResources;
119118
}
120119

121-
}
120+
}

plexus-compilers/plexus-compiler-csharp/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
<description>C# Compiler support for Plexus Compiler component.</description>
1515

1616
<dependencies>
17+
<dependency>
18+
<groupId>org.codehaus.plexus</groupId>
19+
<artifactId>plexus-component-annotations</artifactId>
20+
</dependency>
1721
<dependency>
1822
<groupId>org.codehaus.plexus</groupId>
1923
<artifactId>plexus-utils</artifactId>

plexus-compilers/plexus-compiler-csharp/src/main/java/org/codehaus/plexus/compiler/csharp/CSharpCompiler.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.codehaus.plexus.compiler.CompilerMessage;
2323
import org.codehaus.plexus.compiler.CompilerOutputStyle;
2424
import org.codehaus.plexus.compiler.CompilerResult;
25+
import org.codehaus.plexus.component.annotations.Component;
2526
import org.codehaus.plexus.util.DirectoryScanner;
2627
import org.codehaus.plexus.util.IOUtil;
2728
import org.codehaus.plexus.util.Os;
@@ -54,9 +55,8 @@
5455
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
5556
* @author <a href="mailto:matthew.pocock@ncl.ac.uk">Matthew Pocock</a>
5657
* @author <a href="mailto:chris.stevenson@gmail.com">Chris Stevenson</a>
57-
* @plexus.component role="org.codehaus.plexus.compiler.Compiler"
58-
* role-hint="csharp"
5958
*/
59+
@Component( role = Compiler.class, hint = "csharp" )
6060
public class CSharpCompiler
6161
extends AbstractCompiler
6262
{
@@ -242,7 +242,7 @@ private String findExecutable( CompilerConfiguration config )
242242
private String[] buildCompilerArguments( CompilerConfiguration config, String[] sourceFiles )
243243
throws CompilerException
244244
{
245-
List<String> args = new ArrayList<String>();
245+
List<String> args = new ArrayList<>();
246246

247247
if ( config.isDebug() )
248248
{
@@ -358,7 +358,7 @@ private String[] buildCompilerArguments( CompilerConfiguration config, String[]
358358

359359
if ( !StringUtils.isEmpty( resourcefile ) )
360360
{
361-
String resourceTarget = (String) compilerArguments.get( "-resourcetarget" );
361+
String resourceTarget = compilerArguments.get( "-resourcetarget" );
362362
args.add( "/res:" + new File( resourcefile ).getAbsolutePath() + "," + resourceTarget );
363363
}
364364

@@ -439,7 +439,7 @@ private File findResourceDir( CompilerConfiguration config )
439439

440440
Map<String, String> compilerArguments = getCompilerArguments( config );
441441

442-
String tempResourcesDirAsString = (String) compilerArguments.get( "-resourceDir" );
442+
String tempResourcesDirAsString = compilerArguments.get( "-resourceDir" );
443443
File filteredResourceDir = null;
444444
if ( tempResourcesDirAsString != null )
445445
{
@@ -548,7 +548,7 @@ private List<CompilerMessage> compileOutOfProcess( File workingDirectory, File t
548548
public static List<CompilerMessage> parseCompilerOutput( BufferedReader bufferedReader )
549549
throws IOException
550550
{
551-
List<CompilerMessage> messages = new ArrayList<CompilerMessage>();
551+
List<CompilerMessage> messages = new ArrayList<>();
552552

553553
String line = bufferedReader.readLine();
554554

@@ -582,7 +582,7 @@ private String getType( Map<String, String> compilerArguments )
582582
private String getTypeExtension( CompilerConfiguration configuration )
583583
throws CompilerException
584584
{
585-
String type = getType( configuration.getCustomCompilerArguments() );
585+
String type = getType( configuration.getCustomCompilerArgumentsAsMap() );
586586

587587
if ( "exe".equals( type ) || "winexe".equals( type ) )
588588
{
@@ -600,7 +600,7 @@ private String getTypeExtension( CompilerConfiguration configuration )
600600
// added for debug purposes....
601601
protected static String[] getSourceFiles( CompilerConfiguration config )
602602
{
603-
Set<String> sources = new HashSet<String>();
603+
Set<String> sources = new HashSet<>();
604604

605605
//Set sourceFiles = null;
606606
//was:
@@ -637,7 +637,7 @@ protected static String[] getSourceFiles( CompilerConfiguration config )
637637
}
638638
else
639639
{
640-
result = (String[]) sources.toArray( new String[sources.size()] );
640+
result = sources.toArray( new String[sources.size()] );
641641
}
642642

643643
return result;
@@ -685,7 +685,7 @@ protected static Set<String> getSourceFilesForSourceRoot( CompilerConfiguration
685685

686686
String[] sourceDirectorySources = scanner.getIncludedFiles();
687687

688-
Set<String> sources = new HashSet<String>();
688+
Set<String> sources = new HashSet<>();
689689

690690
for ( String source : sourceDirectorySources )
691691
{

plexus-compilers/plexus-compiler-eclipse/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
<artifactId>ecj</artifactId>
2424
<version>3.22.0</version>
2525
</dependency>
26+
<dependency>
27+
<groupId>org.codehaus.plexus</groupId>
28+
<artifactId>plexus-component-annotations</artifactId>
29+
</dependency>
2630
</dependencies>
2731

2832
<profiles>

plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EcjFailureException.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
* @author <a href="mailto:jal@etc.to">Frits Jalvingh</a>
55
* Created on 22-4-18.
66
*/
7-
public class EcjFailureException extends RuntimeException {
7+
public class EcjFailureException
8+
extends RuntimeException
9+
{
810
private final String ecjOutput;
911

10-
public EcjFailureException(String ecjOutput) {
11-
super("Failed to run the ecj compiler: " + ecjOutput);
12+
public EcjFailureException( String ecjOutput )
13+
{
14+
super( "Failed to run the ecj compiler: " + ecjOutput );
1215
this.ecjOutput = ecjOutput;
1316
}
1417

0 commit comments

Comments
 (0)