From fb711306baf6a94b19997c3bee86093e9e420770 Mon Sep 17 00:00:00 2001
From: Elliotte Rusty Harold
Date: Tue, 23 May 2023 12:50:46 +0000
Subject: [PATCH] [JXR-178] Update parent pom to 39 (#98)
* parent pom 39
* spotless format
* remove extra copyright notices
* still more copyright notices
---
maven-jxr-plugin/pom.xml | 15 +-
.../maven/plugin/jxr/AbstractJxrReport.java | 452 ++++-----
.../maven/plugin/jxr/AggregatorJxrReport.java | 15 +-
.../plugin/jxr/AggregatorJxrTestReport.java | 15 +-
.../maven/plugin/jxr/JxrNoForkReport.java | 12 +-
.../apache/maven/plugin/jxr/JxrReport.java | 91 +-
.../maven/plugin/jxr/JxrReportUtil.java | 140 ++-
.../maven/plugin/jxr/JxrTestNoForkReport.java | 12 +-
.../maven/plugin/jxr/JxrTestReport.java | 76 +-
.../maven/plugin/jxr/AbstractJxrTestCase.java | 87 +-
.../jxr/DependencyArtifactStubFactory.java | 51 +-
.../maven/plugin/jxr/JxrReportTest.java | 423 ++++-----
.../maven/plugin/jxr/JxrTestReportTest.java | 44 +-
.../AggregateSubmodule1MavenProjectStub.java | 37 +-
.../AggregateSubmodule2MavenProjectStub.java | 41 +-
.../stubs/AggregateTestMavenProjectStub.java | 60 +-
.../jxr/stubs/DefaultArtifactHandlerStub.java | 17 +-
.../DefaultConfigurationMavenProjectStub.java | 60 +-
.../ExcludeConfigurationMavenProjectStub.java | 57 +-
.../IncludeConfigurationMavenProjectStub.java | 58 +-
.../jxr/stubs/JxrPluginArtifactStub.java | 48 +-
.../plugin/jxr/stubs/JxrProjectStub.java | 22 +-
.../stubs/NoJavadocDirMavenProjectStub.java | 59 +-
...adocLinkConfigurationMavenProjectStub.java | 62 +-
.../plugin/jxr/stubs/PomMavenProjectStub.java | 70 +-
.../stubs/TestSourceDirMavenProjectStub.java | 53 +-
maven-jxr/pom.xml | 64 +-
.../apache/maven/jxr/DirectoryIndexer.java | 241 ++---
.../main/java/org/apache/maven/jxr/JXR.java | 137 ++-
.../apache/maven/jxr/JavaCodeTransform.java | 872 ++++++++----------
.../org/apache/maven/jxr/JxrException.java | 12 +-
.../maven/jxr/ant/DirectoryScanner.java | 16 +-
.../org/apache/maven/jxr/pacman/BaseType.java | 19 +-
.../apache/maven/jxr/pacman/ClassType.java | 26 +-
.../apache/maven/jxr/pacman/FileManager.java | 30 +-
.../apache/maven/jxr/pacman/ImportType.java | 36 +-
.../org/apache/maven/jxr/pacman/JavaFile.java | 73 +-
.../apache/maven/jxr/pacman/JavaFileImpl.java | 139 +--
.../maven/jxr/pacman/PackageManager.java | 119 +--
.../apache/maven/jxr/pacman/PackageType.java | 32 +-
.../maven/jxr/util/SimpleWordTokenizer.java | 65 +-
.../apache/maven/jxr/util/StringEntry.java | 16 +-
.../maven/jxr/DirectoryIndexerTest.java | 57 +-
.../apache/maven/jxr/IncludeExcludeTest.java | 52 +-
.../java/org/apache/maven/jxr/JXR141Test.java | 67 +-
.../maven/jxr/JavaCodeTransformTest.java | 155 ++--
.../org/apache/maven/jxr/JxrBeanTest.java | 32 +-
.../maven/jxr/pacman/JavaFileImplTest.java | 69 +-
.../jxr/util/SimpleWordTokenizerTest.java | 135 ++-
pom.xml | 40 +-
50 files changed, 1930 insertions(+), 2651 deletions(-)
diff --git a/maven-jxr-plugin/pom.xml b/maven-jxr-plugin/pom.xml
index 226b9ed7..20b9078e 100644
--- a/maven-jxr-plugin/pom.xml
+++ b/maven-jxr-plugin/pom.xml
@@ -1,5 +1,4 @@
-
-
4.0.0
@@ -35,15 +33,15 @@ under the License.
Maven JXR Plugin
2005
+
+ ${mavenVersion}
+
+
3.2.5
1.0.0.v20140518
-
- ${mavenVersion}
-
-
org.apache.maven
@@ -84,7 +82,8 @@ under the License.
org.apache.maven.wagon
wagon-provider-api
- 2.8
+ 2.8
+
org.apache.maven.reporting
@@ -121,8 +120,8 @@ under the License.
test
- plexus-container-default
org.codehaus.plexus
+ plexus-container-default
diff --git a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
index 0d66f1c7..b239be91 100644
--- a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
+++ b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugin.jxr;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugin.jxr;
import java.io.File;
import java.io.IOException;
@@ -53,30 +52,31 @@
* @author Brett Porter
* @author Vincent Siveton
*/
-public abstract class AbstractJxrReport
- extends AbstractMavenReport
-{
+public abstract class AbstractJxrReport extends AbstractMavenReport {
- @Parameter( defaultValue = "${session}", readonly = true, required = true )
+ @Parameter(defaultValue = "${session}", readonly = true, required = true)
private MavenSession session;
/**
* Title of window of the Xref HTML files.
*/
- @Parameter( defaultValue = "${project.name} ${project.version} Reference" )
+ @Parameter(defaultValue = "${project.name} ${project.version} Reference")
private String windowTitle;
/**
* Title of main page of the Xref HTML files.
*/
- @Parameter( defaultValue = "${project.name} ${project.version} Reference" )
+ @Parameter(defaultValue = "${project.name} ${project.version} Reference")
private String docTitle;
// CHECKSTYLE_OFF: LineLength
/**
* String used at the bottom of the Xref HTML files.
*/
- @Parameter( property = "bottom", defaultValue = "Copyright © {inceptionYear}–{currentYear} {organizationName}. All rights reserved." )
+ @Parameter(
+ property = "bottom",
+ defaultValue =
+ "Copyright © {inceptionYear}–{currentYear} {organizationName}. All rights reserved.")
private String bottom;
// CHECKSTYLE_ON: LineLength
@@ -114,7 +114,7 @@ public abstract class AbstractJxrReport
/**
* The projects in the reactor for aggregation report.
*/
- @Parameter( defaultValue = "${reactorProjects}", readonly = true )
+ @Parameter(defaultValue = "${reactorProjects}", readonly = true)
protected List reactorProjects;
/**
@@ -122,14 +122,14 @@ public abstract class AbstractJxrReport
*
* @since 2.3
*/
- @Parameter( property = "maven.jxr.skip", defaultValue = "false" )
+ @Parameter(property = "maven.jxr.skip", defaultValue = "false")
protected boolean skip;
/**
* Link the Javadoc from the Source XRef. Defaults to true and will link automatically if javadoc plugin is being
* used.
*/
- @Parameter( defaultValue = "true" )
+ @Parameter(defaultValue = "true")
private boolean linkJavadoc;
/**
@@ -137,7 +137,7 @@ public abstract class AbstractJxrReport
* The value should reflect `java.specification.version`, "1.4", "1.8", "9", "10",
* by default this system property is used.
*/
- @Parameter( property = "javadocVersion" )
+ @Parameter(property = "javadocVersion")
private String javadocVersion;
/**
@@ -151,14 +151,11 @@ public abstract class AbstractJxrReport
* @param sourceDirs the List of the source directories
* @return a List of the directories that will be included in the JXR report generation
*/
- protected List pruneSourceDirs( List sourceDirs )
- {
- List pruned = new ArrayList<>( sourceDirs.size() );
- for ( String dir : sourceDirs )
- {
- if ( !pruned.contains( dir ) && hasSources( new File( dir ) ) )
- {
- pruned.add( dir );
+ protected List pruneSourceDirs(List sourceDirs) {
+ List pruned = new ArrayList<>(sourceDirs.size());
+ for (String dir : sourceDirs) {
+ if (!pruned.contains(dir) && hasSources(new File(dir))) {
+ pruned.add(dir);
}
}
return pruned;
@@ -167,17 +164,13 @@ protected List pruneSourceDirs( List sourceDirs )
/**
* Initialize some attributes required during the report generation
*/
- protected void init()
- {
+ protected void init() {
// wanna know if Javadoc is being generated
// TODO: what if it is not part of the site though, and just on the command line?
- if ( project.getModel().getReporting() != null )
- {
- for ( ReportPlugin reportPlugin : Collections.unmodifiableList(
- project.getModel().getReporting().getPlugins() ) )
- {
- if ( "maven-javadoc-plugin".equals( reportPlugin.getArtifactId() ) )
- {
+ if (project.getModel().getReporting() != null) {
+ for (ReportPlugin reportPlugin : Collections.unmodifiableList(
+ project.getModel().getReporting().getPlugins())) {
+ if ("maven-javadoc-plugin".equals(reportPlugin.getArtifactId())) {
break;
}
}
@@ -190,24 +183,16 @@ protected void init()
* @param dir the source directory
* @return true if the folder or one of its subfolders contains at least 1 Java file
*/
- private boolean hasSources( File dir )
- {
- if ( dir.exists() && dir.isDirectory() )
- {
- for ( File currentFile : dir.listFiles() )
- {
- if ( currentFile.isFile() )
- {
- if ( currentFile.getName().endsWith( ".java" ) )
- {
+ private boolean hasSources(File dir) {
+ if (dir.exists() && dir.isDirectory()) {
+ for (File currentFile : dir.listFiles()) {
+ if (currentFile.isFile()) {
+ if (currentFile.getName().endsWith(".java")) {
return true;
}
- }
- else
- {
- if ( Character.isJavaIdentifierStart( currentFile.getName().charAt( 0 ) ) // avoid .svn directory
- && hasSources( currentFile ) )
- {
+ } else {
+ if (Character.isJavaIdentifierStart(currentFile.getName().charAt(0)) // avoid .svn directory
+ && hasSources(currentFile)) {
return true;
}
}
@@ -226,99 +211,81 @@ && hasSources( currentFile ) )
* @throws java.io.IOException
* @throws org.apache.maven.jxr.JxrException
*/
- private void createXref( Locale locale, String destinationDirectory, List sourceDirs )
- throws IOException, JxrException
- {
+ private void createXref(Locale locale, String destinationDirectory, List sourceDirs)
+ throws IOException, JxrException {
FileManager fileManager = new FileManager();
- PackageManager packageManager = new PackageManager( fileManager );
- JavaCodeTransform codeTransform = new JavaCodeTransform( packageManager, fileManager );
-
- JXR jxr = new JXR( packageManager, codeTransform );
- jxr.setDest( Paths.get( destinationDirectory ) );
- jxr.setInputEncoding( getInputEncoding() );
- jxr.setLocale( locale );
- jxr.setOutputEncoding( getOutputEncoding() );
- jxr.setRevision( "HEAD" );
- jxr.setJavadocLinkDir( getJavadocLocation() );
+ PackageManager packageManager = new PackageManager(fileManager);
+ JavaCodeTransform codeTransform = new JavaCodeTransform(packageManager, fileManager);
+
+ JXR jxr = new JXR(packageManager, codeTransform);
+ jxr.setDest(Paths.get(destinationDirectory));
+ jxr.setInputEncoding(getInputEncoding());
+ jxr.setLocale(locale);
+ jxr.setOutputEncoding(getOutputEncoding());
+ jxr.setRevision("HEAD");
+ jxr.setJavadocLinkDir(getJavadocLocation());
// Set include/exclude patterns on the jxr instance
- if ( excludes != null && !excludes.isEmpty() )
- {
- jxr.setExcludes( excludes.toArray( new String[0] ) );
+ if (excludes != null && !excludes.isEmpty()) {
+ jxr.setExcludes(excludes.toArray(new String[0]));
}
- if ( includes != null && !includes.isEmpty() )
- {
- jxr.setIncludes( includes.toArray( new String[0] ) );
+ if (includes != null && !includes.isEmpty()) {
+ jxr.setIncludes(includes.toArray(new String[0]));
}
// avoid winding up using Velocity in two class loaders.
ClassLoader savedTccl = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
- jxr.xref( sourceDirs, getTemplateDir(), windowTitle, docTitle, getBottomText() );
- }
- finally
- {
- Thread.currentThread().setContextClassLoader( savedTccl );
+ try {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ jxr.xref(sourceDirs, getTemplateDir(), windowTitle, docTitle, getBottomText());
+ } finally {
+ Thread.currentThread().setContextClassLoader(savedTccl);
}
// and finally copy the stylesheet
- copyRequiredResources( destinationDirectory );
+ copyRequiredResources(destinationDirectory);
}
/**
* Returns the bottom text to be displayed at the lower part of the generated JXR reports.
*/
- private String getBottomText()
- {
- int currentYear = Calendar.getInstance().get( Calendar.YEAR );
- String year = String.valueOf( currentYear );
+ private String getBottomText() {
+ int currentYear = Calendar.getInstance().get(Calendar.YEAR);
+ String year = String.valueOf(currentYear);
String inceptionYear = project.getInceptionYear();
- String theBottom = StringUtils.replace( this.bottom, "{currentYear}", year );
+ String theBottom = StringUtils.replace(this.bottom, "{currentYear}", year);
- if ( inceptionYear != null )
- {
- if ( inceptionYear.equals( year ) )
- {
- theBottom = StringUtils.replace( theBottom, "{inceptionYear}–", "" );
- }
- else
- {
- theBottom = StringUtils.replace( theBottom, "{inceptionYear}", inceptionYear );
+ if (inceptionYear != null) {
+ if (inceptionYear.equals(year)) {
+ theBottom = StringUtils.replace(theBottom, "{inceptionYear}–", "");
+ } else {
+ theBottom = StringUtils.replace(theBottom, "{inceptionYear}", inceptionYear);
}
- }
- else
- {
- theBottom = StringUtils.replace( theBottom, "{inceptionYear}–", "" );
+ } else {
+ theBottom = StringUtils.replace(theBottom, "{inceptionYear}–", "");
}
- if ( project.getOrganization() == null )
- {
- theBottom = StringUtils.replace( theBottom, " {organizationName}", "" );
- }
- else
- {
- if ( StringUtils.isNotEmpty( project.getOrganization().getName() ) )
- {
- if ( StringUtils.isNotEmpty( project.getOrganization().getUrl() ) )
- {
+ if (project.getOrganization() == null) {
+ theBottom = StringUtils.replace(theBottom, " {organizationName}", "");
+ } else {
+ if (StringUtils.isNotEmpty(project.getOrganization().getName())) {
+ if (StringUtils.isNotEmpty(project.getOrganization().getUrl())) {
// CHECKSTYLE_OFF: LineLength
- theBottom =
- StringUtils.replace( theBottom, "{organizationName}", "" + project.getOrganization().getName() + "" );
+ theBottom = StringUtils.replace(
+ theBottom,
+ "{organizationName}",
+ ""
+ + project.getOrganization().getName() + "");
// CHECKSTYLE_ON: LineLength
+ } else {
+ theBottom = StringUtils.replace(
+ theBottom,
+ "{organizationName}",
+ project.getOrganization().getName());
}
- else
- {
- theBottom =
- StringUtils.replace( theBottom, "{organizationName}", project.getOrganization().getName() );
- }
- }
- else
- {
- theBottom = StringUtils.replace( theBottom, " {organizationName}", "" );
+ } else {
+ theBottom = StringUtils.replace(theBottom, " {organizationName}", "");
}
}
@@ -330,60 +297,40 @@ private String getBottomText()
*
* @param dir the directory to copy the resources to
*/
- private void copyRequiredResources( String dir )
- {
- if ( stylesheet != null && !stylesheet.isEmpty() )
- {
- File stylesheetFile = new File( stylesheet );
- File destStylesheetFile = new File( dir, "stylesheet.css" );
-
- try
- {
- if ( stylesheetFile.isAbsolute() )
- {
- FileUtils.copyFile( stylesheetFile, destStylesheetFile );
+ private void copyRequiredResources(String dir) {
+ if (stylesheet != null && !stylesheet.isEmpty()) {
+ File stylesheetFile = new File(stylesheet);
+ File destStylesheetFile = new File(dir, "stylesheet.css");
+
+ try {
+ if (stylesheetFile.isAbsolute()) {
+ FileUtils.copyFile(stylesheetFile, destStylesheetFile);
+ } else {
+ URL stylesheetUrl = this.getClass().getClassLoader().getResource(stylesheet);
+ FileUtils.copyURLToFile(stylesheetUrl, destStylesheetFile);
}
- else
- {
- URL stylesheetUrl = this.getClass().getClassLoader().getResource( stylesheet );
- FileUtils.copyURLToFile( stylesheetUrl, destStylesheetFile );
- }
- }
- catch ( IOException e )
- {
- getLog().warn( "An error occured while copying the stylesheet to the target directory", e );
- }
- }
- else
- {
- if ( javadocTemplatesVersion.isAtLeast( "1.8" ) )
- {
- copyResources( dir, "jdk8/", "stylesheet.css" );
+ } catch (IOException e) {
+ getLog().warn("An error occured while copying the stylesheet to the target directory", e);
}
- else if ( javadocTemplatesVersion.isAtLeast( "1.7" ) )
- {
- String[] jdk7Resources =
- {
+ } else {
+ if (javadocTemplatesVersion.isAtLeast("1.8")) {
+ copyResources(dir, "jdk8/", "stylesheet.css");
+ } else if (javadocTemplatesVersion.isAtLeast("1.7")) {
+ String[] jdk7Resources = {
"stylesheet.css",
"resources/background.gif",
"resources/tab.gif",
"resources/titlebar.gif",
"resources/titlebar_end.gif"
};
- copyResources( dir, "jdk7/", jdk7Resources );
- }
- else if ( javadocTemplatesVersion.isAtLeast( "1.6" ) )
- {
- copyResources( dir, "jdk6/", "stylesheet.css" );
- }
- else if ( javadocTemplatesVersion.isAtLeast( "1.4" ) )
- {
- copyResources( dir, "jdk4/", "stylesheet.css" );
- }
- else
- {
+ copyResources(dir, "jdk7/", jdk7Resources);
+ } else if (javadocTemplatesVersion.isAtLeast("1.6")) {
+ copyResources(dir, "jdk6/", "stylesheet.css");
+ } else if (javadocTemplatesVersion.isAtLeast("1.4")) {
+ copyResources(dir, "jdk4/", "stylesheet.css");
+ } else {
// Fallback to the original stylesheet
- copyResources( dir, "", "stylesheet.css" );
+ copyResources(dir, "", "stylesheet.css");
}
}
}
@@ -395,26 +342,20 @@ else if ( javadocTemplatesVersion.isAtLeast( "1.4" ) )
* @param sourceFolder resources subfolder to copy from
* @param files names of files to copy
*/
- private void copyResources( String dir, String sourceFolder, String... files )
- {
- try
- {
- for ( String file : files )
- {
- URL resourceUrl = this.getClass().getClassLoader().getResource( sourceFolder + file );
- File destResourceFile = new File( dir, file );
- FileUtils.copyURLToFile( resourceUrl, destResourceFile );
+ private void copyResources(String dir, String sourceFolder, String... files) {
+ try {
+ for (String file : files) {
+ URL resourceUrl = this.getClass().getClassLoader().getResource(sourceFolder + file);
+ File destResourceFile = new File(dir, file);
+ FileUtils.copyURLToFile(resourceUrl, destResourceFile);
}
- }
- catch ( IOException e )
- {
- getLog().warn( "An error occured while copying the resource to the target directory", e );
+ } catch (IOException e) {
+ getLog().warn("An error occured while copying the resource to the target directory", e);
}
}
@Override
- protected MavenProject getProject()
- {
+ protected MavenProject getProject() {
return project;
}
@@ -422,8 +363,7 @@ protected MavenProject getProject()
* Returns the Maven session.
* @return Maven session
*/
- protected MavenSession getSession()
- {
+ protected MavenSession getSession() {
return session;
}
@@ -433,9 +373,8 @@ protected MavenSession getSession()
* @param locale the locale of the user
* @return the bundle corresponding to the locale
*/
- protected ResourceBundle getBundle( Locale locale )
- {
- return ResourceBundle.getBundle( "jxr-report", locale, this.getClass().getClassLoader() );
+ protected ResourceBundle getBundle(Locale locale) {
+ return ResourceBundle.getBundle("jxr-report", locale, this.getClass().getClassLoader());
}
/**
@@ -444,72 +383,53 @@ protected ResourceBundle getBundle( Locale locale )
* @param sourceDirs list of source directories
* @return true if the report could be generated
*/
- protected boolean canGenerateReport( List sourceDirs )
- {
+ protected boolean canGenerateReport(List sourceDirs) {
boolean canGenerate = !sourceDirs.isEmpty();
- if ( isAggregate() && !project.isExecutionRoot() )
- {
+ if (isAggregate() && !project.isExecutionRoot()) {
canGenerate = false;
}
return canGenerate;
}
@Override
- protected void executeReport( Locale locale )
- throws MavenReportException
- {
- if ( skip )
- {
- getLog().info( "Skipping JXR." );
+ protected void executeReport(Locale locale) throws MavenReportException {
+ if (skip) {
+ getLog().info("Skipping JXR.");
return;
}
List sourceDirs = constructSourceDirs();
- if ( canGenerateReport( sourceDirs ) )
- {
+ if (canGenerateReport(sourceDirs)) {
// init some attributes -- TODO (javadoc)
init();
// determine version of templates to use
setJavadocTemplatesVersion();
- try
- {
- createXref( locale, getDestinationDirectory(), sourceDirs );
- }
- catch ( JxrException | IOException e )
- {
- throw new MavenReportException( "Error while generating the HTML source code of the project.", e );
+ try {
+ createXref(locale, getDestinationDirectory(), sourceDirs);
+ } catch (JxrException | IOException e) {
+ throw new MavenReportException("Error while generating the HTML source code of the project.", e);
}
}
}
-
/**
* Determine the templateDir to use, given javadocTemplatesVersion
*
* @return
*/
- private String getTemplateDir()
- {
+ private String getTemplateDir() {
// Check if overridden
- if ( templateDir == null || templateDir.isEmpty() )
- {
- if ( javadocTemplatesVersion.isAtLeast( "1.8" ) )
- {
+ if (templateDir == null || templateDir.isEmpty()) {
+ if (javadocTemplatesVersion.isAtLeast("1.8")) {
return "templates/jdk8";
- }
- else if ( javadocTemplatesVersion.isAtLeast( "1.7" ) )
- {
+ } else if (javadocTemplatesVersion.isAtLeast("1.7")) {
return "templates/jdk7";
- }
- else if ( javadocTemplatesVersion.isAtLeast( "1.4" ) )
- {
+ } else if (javadocTemplatesVersion.isAtLeast("1.4")) {
return "templates/jdk4";
- }
- else
- {
- getLog().warn( "Unsupported javadocVersion: " + javadocTemplatesVersion + ". Fallback to original" );
+ } else {
+ getLog().warn("Unsupported javadocVersion: " + javadocTemplatesVersion + ". Fallback to original");
return "templates";
}
}
@@ -520,16 +440,12 @@ else if ( javadocTemplatesVersion.isAtLeast( "1.4" ) )
/**
* Sets a new value for {@code javadocTemplatesVersion}.
*/
- private void setJavadocTemplatesVersion()
- {
+ private void setJavadocTemplatesVersion() {
JavaVersion javaVersion = JavaVersion.JAVA_SPECIFICATION_VERSION;
- if ( javadocVersion != null && !javadocVersion.isEmpty() )
- {
- javadocTemplatesVersion = JavaVersion.parse( javadocVersion );
- }
- else
- {
+ if (javadocVersion != null && !javadocVersion.isEmpty()) {
+ javadocTemplatesVersion = JavaVersion.parse(javadocVersion);
+ } else {
javadocTemplatesVersion = javaVersion;
}
}
@@ -539,102 +455,81 @@ private void setJavadocTemplatesVersion()
*
* @return a List of the source directories whose contents will be included in the JXR report generation
*/
- protected List constructSourceDirs()
- {
- List sourceDirs = new ArrayList<>( getSourceRoots() );
- if ( isAggregate() )
- {
- for ( MavenProject project : reactorProjects )
- {
- if ( "java".equals( project.getArtifact().getArtifactHandler().getLanguage() ) )
- {
- sourceDirs.addAll( getSourceRoots( project ) );
+ protected List constructSourceDirs() {
+ List sourceDirs = new ArrayList<>(getSourceRoots());
+ if (isAggregate()) {
+ for (MavenProject project : reactorProjects) {
+ if ("java".equals(project.getArtifact().getArtifactHandler().getLanguage())) {
+ sourceDirs.addAll(getSourceRoots(project));
}
}
}
- sourceDirs = pruneSourceDirs( sourceDirs );
+ sourceDirs = pruneSourceDirs(sourceDirs);
return sourceDirs;
}
@Override
- public boolean canGenerateReport()
- {
- return canGenerateReport( constructSourceDirs() );
+ public boolean canGenerateReport() {
+ return canGenerateReport(constructSourceDirs());
}
@Override
- public boolean isExternalReport()
- {
+ public boolean isExternalReport() {
return true;
}
/**
* @return a String that contains the location of the javadocs
*/
- private Path getJavadocLocation()
- throws IOException
- {
+ private Path getJavadocLocation() throws IOException {
Path location = null;
- if ( linkJavadoc )
- {
+ if (linkJavadoc) {
// We don't need to do the whole translation thing like normal, because JXR does it internally.
// It probably shouldn't.
- if ( getJavadocDir().exists() )
- {
+ if (getJavadocDir().exists()) {
// XRef was already generated by manual execution of a lifecycle binding
location = getJavadocDir().toPath().toAbsolutePath();
- }
- else
- {
+ } else {
// Not yet generated - check if the report is on its way
// Special case: using the site:stage goal
- String stagingDirectory = System.getProperty( "stagingDirectory" );
+ String stagingDirectory = System.getProperty("stagingDirectory");
- if ( stagingDirectory != null && !stagingDirectory.isEmpty() )
- {
+ if (stagingDirectory != null && !stagingDirectory.isEmpty()) {
String javadocDestDir = getJavadocDir().getName();
- boolean javadocAggregate = JxrReportUtil.isJavadocAggregated( project );
- String structureProject = JxrReportUtil.getStructure( project, false );
+ boolean javadocAggregate = JxrReportUtil.isJavadocAggregated(project);
+ String structureProject = JxrReportUtil.getStructure(project, false);
- if ( isAggregate() && javadocAggregate )
- {
- location = Paths.get( stagingDirectory, structureProject, javadocDestDir );
+ if (isAggregate() && javadocAggregate) {
+ location = Paths.get(stagingDirectory, structureProject, javadocDestDir);
}
- if ( !isAggregate() && javadocAggregate )
- {
- location = Paths.get( stagingDirectory, javadocDestDir );
+ if (!isAggregate() && javadocAggregate) {
+ location = Paths.get(stagingDirectory, javadocDestDir);
String hierarchy = project.getName();
MavenProject parent = project.getParent();
- while ( parent != null )
- {
+ while (parent != null) {
hierarchy = parent.getName();
parent = parent.getParent();
}
- location = Paths.get( stagingDirectory, hierarchy, javadocDestDir );
+ location = Paths.get(stagingDirectory, hierarchy, javadocDestDir);
}
- if ( isAggregate() && !javadocAggregate )
- {
- getLog().warn( "The JXR plugin is configured to build an aggregated report at the root, "
- + "not the Javadoc plugin." );
+ if (isAggregate() && !javadocAggregate) {
+ getLog().warn("The JXR plugin is configured to build an aggregated report at the root, "
+ + "not the Javadoc plugin.");
}
- if ( !isAggregate() && !javadocAggregate )
- {
- location = Paths.get( stagingDirectory, structureProject, javadocDestDir );
+ if (!isAggregate() && !javadocAggregate) {
+ location = Paths.get(stagingDirectory, structureProject, javadocDestDir);
}
- }
- else
- {
+ } else {
location = getJavadocDir().toPath();
}
}
- if ( location == null )
- {
- getLog().warn( "Unable to locate Javadoc to link to - DISABLED" );
+ if (location == null) {
+ getLog().warn("Unable to locate Javadoc to link to - DISABLED");
}
}
@@ -662,7 +557,7 @@ private Path getJavadocLocation()
* @param project the MavenProject where the JXR report plugin will be executed
* @return a List of the source directories
*/
- protected abstract List getSourceRoots( MavenProject project );
+ protected abstract List getSourceRoots(MavenProject project);
/**
* Abstract method that returns the directory of the javadoc files.
@@ -676,8 +571,7 @@ private Path getJavadocLocation()
*
* @return true if aggregate, false otherwise
*/
- protected boolean isAggregate()
- {
+ protected boolean isAggregate() {
return false;
}
}
diff --git a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AggregatorJxrReport.java b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AggregatorJxrReport.java
index d5e331bc..3f6ee68a 100644
--- a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AggregatorJxrReport.java
+++ b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AggregatorJxrReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugin.jxr;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugin.jxr;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
@@ -28,16 +27,12 @@
*
* @since 2.3
*/
-@Mojo( name = "aggregate", aggregator = true )
-@Execute( phase = LifecyclePhase.COMPILE )
-public class AggregatorJxrReport
- extends JxrReport
-{
+@Mojo(name = "aggregate", aggregator = true)
+@Execute(phase = LifecyclePhase.COMPILE)
+public class AggregatorJxrReport extends JxrReport {
@Override
- protected boolean isAggregate()
- {
+ protected boolean isAggregate() {
return true;
}
-
}
diff --git a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AggregatorJxrTestReport.java b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AggregatorJxrTestReport.java
index 9156ac2e..3be1fc2d 100644
--- a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AggregatorJxrTestReport.java
+++ b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AggregatorJxrTestReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugin.jxr;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugin.jxr;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
@@ -28,15 +27,11 @@
*
* @since 2.3
*/
-@Mojo( name = "test-aggregate", aggregator = true )
-@Execute( phase = LifecyclePhase.TEST_COMPILE )
-public class AggregatorJxrTestReport
- extends JxrTestReport
-{
+@Mojo(name = "test-aggregate", aggregator = true)
+@Execute(phase = LifecyclePhase.TEST_COMPILE)
+public class AggregatorJxrTestReport extends JxrTestReport {
@Override
- protected boolean isAggregate()
- {
+ protected boolean isAggregate() {
return true;
}
-
}
diff --git a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrNoForkReport.java b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrNoForkReport.java
index eea54b0d..a407ca83 100644
--- a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrNoForkReport.java
+++ b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrNoForkReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugin.jxr;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugin.jxr;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
@@ -30,9 +29,6 @@
*
* @since 3.1.0
*/
-@Mojo( name = "jxr-no-fork" )
-@Execute( phase = LifecyclePhase.NONE )
-public class JxrNoForkReport
- extends JxrReport
-{
-}
+@Mojo(name = "jxr-no-fork")
+@Execute(phase = LifecyclePhase.NONE)
+public class JxrNoForkReport extends JxrReport {}
diff --git a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java
index 7bc724f8..7740d02a 100644
--- a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java
+++ b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugin.jxr;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugin.jxr;
import java.io.File;
import java.util.ArrayList;
@@ -37,15 +36,13 @@
*
* @author Fabrice Bellingard
*/
-@Mojo( name = "jxr" )
-@Execute( phase = LifecyclePhase.GENERATE_SOURCES )
-public class JxrReport
- extends AbstractJxrReport
-{
+@Mojo(name = "jxr")
+@Execute(phase = LifecyclePhase.GENERATE_SOURCES)
+public class JxrReport extends AbstractJxrReport {
/**
* Source directories of the project.
*/
- @Parameter( defaultValue = "${project.compileSourceRoots}", required = true, readonly = true )
+ @Parameter(defaultValue = "${project.compileSourceRoots}", required = true, readonly = true)
private List sourceDirs;
/**
@@ -58,45 +55,38 @@ public class JxrReport
/**
* Folder where the Xref files will be copied to.
*/
- @Parameter( defaultValue = "${project.reporting.outputDirectory}/xref" )
+ @Parameter(defaultValue = "${project.reporting.outputDirectory}/xref")
private String destDir;
/**
* Folder where Javadoc is generated for this project.
*/
- @Parameter( defaultValue = "${project.reporting.outputDirectory}/apidocs" )
+ @Parameter(defaultValue = "${project.reporting.outputDirectory}/apidocs")
private File javadocDir;
@Override
- protected String getDestinationDirectory()
- {
+ protected String getDestinationDirectory() {
return destDir;
}
@Override
- protected List getSourceRoots()
- {
- if ( sourcePath != null )
- {
- String[] sourcePathArray = sourcePath.split( ";" );
- if ( sourcePathArray.length > 0 )
- {
- return Arrays.asList( sourcePathArray );
+ protected List getSourceRoots() {
+ if (sourcePath != null) {
+ String[] sourcePathArray = sourcePath.split(";");
+ if (sourcePathArray.length > 0) {
+ return Arrays.asList(sourcePathArray);
}
}
List l = new ArrayList<>();
- if ( !"pom".equals( getProject().getPackaging().toLowerCase( Locale.US ) ) )
- {
- l.addAll( sourceDirs );
+ if (!"pom".equals(getProject().getPackaging().toLowerCase(Locale.US))) {
+ l.addAll(sourceDirs);
}
- if ( getProject().getExecutionProject() != null )
- {
- if ( !"pom".equals( getProject().getExecutionProject().getPackaging().toLowerCase( Locale.US ) ) )
- {
- l.addAll( getProject().getExecutionProject().getCompileSourceRoots() );
+ if (getProject().getExecutionProject() != null) {
+ if (!"pom".equals(getProject().getExecutionProject().getPackaging().toLowerCase(Locale.US))) {
+ l.addAll(getProject().getExecutionProject().getCompileSourceRoots());
}
}
@@ -104,20 +94,16 @@ protected List getSourceRoots()
}
@Override
- protected List getSourceRoots( MavenProject project )
- {
+ protected List getSourceRoots(MavenProject project) {
List l = new ArrayList<>();
- if ( !"pom".equals( project.getPackaging().toLowerCase( Locale.US ) ) )
- {
- l.addAll( project.getCompileSourceRoots() );
+ if (!"pom".equals(project.getPackaging().toLowerCase(Locale.US))) {
+ l.addAll(project.getCompileSourceRoots());
}
- if ( project.getExecutionProject() != null )
- {
- if ( !"pom".equals( project.getExecutionProject().getPackaging().toLowerCase( Locale.US ) ) )
- {
- l.addAll( project.getExecutionProject().getCompileSourceRoots() );
+ if (project.getExecutionProject() != null) {
+ if (!"pom".equals(project.getExecutionProject().getPackaging().toLowerCase(Locale.US))) {
+ l.addAll(project.getExecutionProject().getCompileSourceRoots());
}
}
@@ -125,38 +111,31 @@ protected List getSourceRoots( MavenProject project )
}
@Override
- public String getDescription( Locale locale )
- {
- return getBundle( locale ).getString( "report.xref.main.description" );
+ public String getDescription(Locale locale) {
+ return getBundle(locale).getString("report.xref.main.description");
}
@Override
- public String getName( Locale locale )
- {
- return getBundle( locale ).getString( "report.xref.main.name" );
+ public String getName(Locale locale) {
+ return getBundle(locale).getString("report.xref.main.name");
}
@Override
- public String getOutputName()
- {
+ public String getOutputName() {
return "xref/index";
}
@Override
- protected File getJavadocDir()
- {
+ protected File getJavadocDir() {
return javadocDir;
}
@Override
- public void setReportOutputDirectory( File reportOutputDirectory )
- {
- if ( ( reportOutputDirectory != null ) && ( !reportOutputDirectory.getAbsolutePath().endsWith( "xref" ) ) )
- {
- this.destDir = new File( reportOutputDirectory, "xref" ).getAbsolutePath();
- }
- else
- {
+ public void setReportOutputDirectory(File reportOutputDirectory) {
+ if ((reportOutputDirectory != null)
+ && (!reportOutputDirectory.getAbsolutePath().endsWith("xref"))) {
+ this.destDir = new File(reportOutputDirectory, "xref").getAbsolutePath();
+ } else {
this.destDir = reportOutputDirectory.getAbsolutePath();
}
}
diff --git a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReportUtil.java b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReportUtil.java
index d95a2ffa..2774f4d9 100644
--- a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReportUtil.java
+++ b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReportUtil.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugin.jxr;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugin.jxr;
import java.io.IOException;
import java.util.ArrayList;
@@ -31,13 +30,13 @@
import org.apache.maven.wagon.repository.Repository;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
+
/**
* Utility class for the jxr report.
*
* @author Vincent Siveton
*/
-public class JxrReportUtil
-{
+public class JxrReportUtil {
private static final String MAVEN_JAVADOC_PLUGIN_GROUP_ID = "org.apache.maven.plugins";
@@ -50,29 +49,22 @@ public class JxrReportUtil
* @param project the Maven project
* @return if javadoc is aggregated, false otherwise
*/
- protected static boolean isJavadocAggregated( MavenProject project )
- {
+ protected static boolean isJavadocAggregated(MavenProject project) {
// first check conf for obsolete aggregate param.
- boolean javadocAggregate = Boolean.parseBoolean(
- JxrReportUtil.getMavenJavadocPluginBasicOption( project, "aggregate", "false" ) );
+ boolean javadocAggregate =
+ Boolean.parseBoolean(JxrReportUtil.getMavenJavadocPluginBasicOption(project, "aggregate", "false"));
- if ( javadocAggregate )
- {
+ if (javadocAggregate) {
return true;
}
- for ( Object pluginObject : getMavenJavadocPlugins( project ) )
- {
- if ( pluginObject instanceof Plugin )
- {
+ for (Object pluginObject : getMavenJavadocPlugins(project)) {
+ if (pluginObject instanceof Plugin) {
Plugin plugin = (Plugin) pluginObject;
List executions = plugin.getExecutions();
- for ( PluginExecution pe : executions )
- {
+ for (PluginExecution pe : executions) {
List goals = pe.getGoals();
- for ( String goal : goals )
- {
- if ( "aggregate".equals( goal ) )
- {
+ for (String goal : goals) {
+ if ("aggregate".equals(goal)) {
return true;
}
}
@@ -90,52 +82,44 @@ protected static boolean isJavadocAggregated( MavenProject project )
* @param defaultValue a default value
* @return the value for the option name or the default value. Could be null if not found.
*/
- protected static String getMavenJavadocPluginBasicOption( MavenProject project, String optionName,
- String defaultValue )
- {
+ protected static String getMavenJavadocPluginBasicOption(
+ MavenProject project, String optionName, String defaultValue) {
List
*/
-public class FileManager
-{
+public class FileManager {
private Map files = new HashMap<>();
private String encoding = null;
@@ -49,16 +47,13 @@ public class FileManager
* @return the {@link JavaFile} meta object for the specified file
* @throws IOException on parsing failure
*/
- public JavaFile getFile( Path path )
- throws IOException
- {
+ public JavaFile getFile(Path path) throws IOException {
- JavaFile real = this.files.get( path );
+ JavaFile real = this.files.get(path);
- if ( real == null )
- {
- real = new JavaFileImpl( path, this.getEncoding() );
- this.addFile( real );
+ if (real == null) {
+ real = new JavaFileImpl(path, this.getEncoding());
+ this.addFile(real);
}
return real;
@@ -68,9 +63,8 @@ public JavaFile getFile( Path path )
* Add a file to this file manager.
* @param file file to add
*/
- public void addFile( JavaFile file )
- {
- this.files.put( file.getPath(), file );
+ public void addFile(JavaFile file) {
+ this.files.put(file.getPath(), file);
}
/**
@@ -78,8 +72,7 @@ public void addFile( JavaFile file )
*
* @param encoding encoding of source files
*/
- public void setEncoding( String encoding )
- {
+ public void setEncoding(String encoding) {
this.encoding = encoding;
}
@@ -88,8 +81,7 @@ public void setEncoding( String encoding )
*
* @return encoding
*/
- public String getEncoding()
- {
+ public String getEncoding() {
return encoding;
}
}
diff --git a/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/ImportType.java b/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/ImportType.java
index d9d9f33c..bbdf36b8 100644
--- a/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/ImportType.java
+++ b/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/ImportType.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr.pacman;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,13 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.jxr.pacman;
/**
* Represents an entry in a java "import" statement
*/
-public class ImportType
- extends BaseType
-{
+public class ImportType extends BaseType {
private boolean isclass = false;
@@ -37,22 +34,19 @@ public class ImportType
*
* @param name name
*/
- public ImportType( String name )
- {
- super( name );
+ public ImportType(String name) {
+ super(name);
- //compute member variables
+ // compute member variables
- this.isclass = this.getName().indexOf( '*' ) == -1;
+ this.isclass = this.getName().indexOf('*') == -1;
- this.ispackage = this.getName().indexOf( '*' ) != -1;
+ this.ispackage = this.getName().indexOf('*') != -1;
- int end = this.getName().lastIndexOf( '.' );
- if ( end != -1 )
- {
- this.packagename = this.getName().substring( 0, end );
+ int end = this.getName().lastIndexOf('.');
+ if (end != -1) {
+ this.packagename = this.getName().substring(0, end);
}
-
}
/**
@@ -60,8 +54,7 @@ public ImportType( String name )
*
* @return true if class import, false otherwise
*/
- public boolean isClass()
- {
+ public boolean isClass() {
return this.isclass;
}
@@ -70,8 +63,7 @@ public boolean isClass()
*
* @return true if package, false otherwise
*/
- public boolean isPackage()
- {
+ public boolean isPackage() {
return this.ispackage;
}
@@ -81,9 +73,7 @@ public boolean isPackage()
*
* @return package
*/
- public String getPackage()
- {
+ public String getPackage() {
return this.packagename;
}
-
}
diff --git a/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/JavaFile.java b/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/JavaFile.java
index cb60edf0..6f0be940 100644
--- a/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/JavaFile.java
+++ b/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/JavaFile.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr.pacman;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.jxr.pacman;
import java.nio.file.Path;
import java.util.ArrayList;
@@ -31,8 +30,7 @@
*
* @author Kevin A. Burton
*/
-public abstract class JavaFile
-{
+public abstract class JavaFile {
private Set imports = new HashSet<>();
private List classTypes = new ArrayList<>();
@@ -45,11 +43,10 @@ public abstract class JavaFile
private final String encoding;
- protected JavaFile( Path path, String encoding )
- {
+ protected JavaFile(Path path, String encoding) {
this.path = path;
this.encoding = encoding;
- this.filename = getFilenameWithoutPathOrExtension( path );
+ this.filename = getFilenameWithoutPathOrExtension(path);
}
/**
@@ -57,25 +54,20 @@ protected JavaFile( Path path, String encoding )
*
* @return import types
*/
- public Set getImportTypes()
- {
- return Collections.unmodifiableSet( imports );
+ public Set getImportTypes() {
+ return Collections.unmodifiableSet(imports);
}
/**
* Gets the name of this class.
* @return class type
*/
- public ClassType getClassType()
- {
- if ( classTypes.isEmpty() )
- {
+ public ClassType getClassType() {
+ if (classTypes.isEmpty()) {
return null;
- }
- else
- {
+ } else {
// to retain backward compatibility, return the first class
- return this.classTypes.get( 0 );
+ return this.classTypes.get(0);
}
}
@@ -84,8 +76,7 @@ public ClassType getClassType()
*
* @return list of class types
*/
- public List getClassTypes()
- {
+ public List getClassTypes() {
return this.classTypes;
}
@@ -94,20 +85,17 @@ public List getClassTypes()
*
* @return package type
*/
- public PackageType getPackageType()
- {
+ public PackageType getPackageType() {
return this.packageType;
}
-
/**
* Add a class type to the current list of class types.
*
* @param classType class type
*/
- public void addClassType( ClassType classType )
- {
- this.classTypes.add( classType );
+ public void addClassType(ClassType classType) {
+ this.classTypes.add(classType);
}
/**
@@ -115,9 +103,8 @@ public void addClassType( ClassType classType )
*
* @param importType import type
*/
- public void addImportType( ImportType importType )
- {
- this.imports.add( importType );
+ public void addImportType(ImportType importType) {
+ this.imports.add(importType);
}
/**
@@ -125,11 +112,10 @@ public void addImportType( ImportType importType )
*
* @param classType class type
*/
- public void setClassType( ClassType classType )
- {
+ public void setClassType(ClassType classType) {
// to retain backward compatibility, make sure the list contains only the supplied classType
this.classTypes.clear();
- this.classTypes.add( classType );
+ this.classTypes.add(classType);
}
/**
@@ -137,8 +123,7 @@ public void setClassType( ClassType classType )
*
* @param packageType package type
*/
- public void setPackageType( PackageType packageType )
- {
+ public void setPackageType(PackageType packageType) {
this.packageType = packageType;
}
@@ -147,8 +132,7 @@ public void setPackageType( PackageType packageType )
*
* @return path
*/
- public Path getPath()
- {
+ public Path getPath() {
return this.path;
}
@@ -157,8 +141,7 @@ public Path getPath()
*
* @return file name
*/
- public String getFilename()
- {
+ public String getFilename() {
return filename;
}
@@ -167,8 +150,7 @@ public String getFilename()
*
* @return encoding
*/
- public String getEncoding()
- {
+ public String getEncoding() {
return this.encoding;
}
@@ -178,16 +160,13 @@ public String getEncoding()
* @param path path to modify
* @return modified path
*/
- protected static String getFilenameWithoutPathOrExtension( Path path )
- {
+ protected static String getFilenameWithoutPathOrExtension(Path path) {
String newFilename = path.getFileName().toString();
// Remove the ".java" extension from the filename, if it exists
- int extensionIndex = newFilename.lastIndexOf( ".java" );
- if ( extensionIndex >= 0 )
- {
- newFilename = newFilename.substring( 0, extensionIndex );
+ int extensionIndex = newFilename.lastIndexOf(".java");
+ if (extensionIndex >= 0) {
+ newFilename = newFilename.substring(0, extensionIndex);
}
return newFilename;
}
-
}
diff --git a/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/JavaFileImpl.java b/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/JavaFileImpl.java
index 9c198793..05beb620 100644
--- a/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/JavaFileImpl.java
+++ b/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/JavaFileImpl.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr.pacman;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.jxr.pacman;
import java.io.FileInputStream;
import java.io.FileReader;
@@ -36,11 +35,9 @@
*
* @author Kevin A. Burton
*/
-public class JavaFileImpl
- extends JavaFile
-{
+public class JavaFileImpl extends JavaFile {
- private final List classTypes = Arrays.asList( "class", "interface", "enum", "record" );
+ private final List classTypes = Arrays.asList("class", "interface", "enum", "record");
/**
* Constructor of a new object that points to a given file.
@@ -49,93 +46,71 @@ public class JavaFileImpl
* @param encoding encoding of the file
* @throws IOException on parsing failure
*/
- public JavaFileImpl( Path path, String encoding )
- throws IOException
- {
- super( path, encoding );
+ public JavaFileImpl(Path path, String encoding) throws IOException {
+ super(path, encoding);
- //always add java.lang.* to the package imports because the JVM always
- //does this implicitly. Unless we add this to the ImportTypes JXR
- //won't pick up on this.
- this.addImportType( new ImportType( "java.lang.*" ) );
+ // always add java.lang.* to the package imports because the JVM always
+ // does this implicitly. Unless we add this to the ImportTypes JXR
+ // won't pick up on this.
+ this.addImportType(new ImportType("java.lang.*"));
- //now parse out this file.
+ // now parse out this file.
this.parse();
}
/**
* Opens up the file and try to determine package, class and import statements.
*/
- private void parse()
- throws IOException
- {
+ private void parse() throws IOException {
StreamTokenizer stok = null;
- try ( Reader reader = getReader() )
- {
- stok = this.getTokenizer( reader );
+ try (Reader reader = getReader()) {
+ stok = this.getTokenizer(reader);
- parseRecursive( "", stok );
- }
- finally
- {
+ parseRecursive("", stok);
+ } finally {
stok = null;
}
}
- private void parseRecursive( String nestedPrefix, StreamTokenizer stok )
- throws IOException
- {
+ private void parseRecursive(String nestedPrefix, StreamTokenizer stok) throws IOException {
int openBracesCount = 0;
char prevttype = Character.MIN_VALUE; // previous token type
boolean inTripleQuote = false; // used to toggle between inside/outside triple-quoted multi-line strings
- while ( stok.nextToken() != StreamTokenizer.TT_EOF )
- {
+ while (stok.nextToken() != StreamTokenizer.TT_EOF) {
- if ( stok.sval == null )
- {
- if ( stok.ttype == '{' )
- {
+ if (stok.sval == null) {
+ if (stok.ttype == '{') {
openBracesCount++;
- }
- else if ( stok.ttype == '}' )
- {
- if ( --openBracesCount == 0 )
- {
+ } else if (stok.ttype == '}') {
+ if (--openBracesCount == 0) {
// break out of recursive
return;
}
}
continue;
- }
- else
- {
- if ( '"' == stok.ttype && '"' == prevttype )
- {
+ } else {
+ if ('"' == stok.ttype && '"' == prevttype) {
inTripleQuote = !inTripleQuote;
}
prevttype = (char) stok.ttype;
- if ( inTripleQuote )
- {
+ if (inTripleQuote) {
// skip content found inside triple-quoted multi-line Java 15 String
continue;
}
}
- //set the package
- if ( "package".equals( stok.sval ) && stok.ttype != '\"' )
- {
+ // set the package
+ if ("package".equals(stok.sval) && stok.ttype != '\"') {
stok.nextToken();
- if ( stok.sval != null )
- {
- this.setPackageType( new PackageType( stok.sval ) );
+ if (stok.sval != null) {
+ this.setPackageType(new PackageType(stok.sval));
}
}
- //set the imports
- if ( "import".equals( stok.sval ) && stok.ttype != '\"' )
- {
+ // set the imports
+ if ("import".equals(stok.sval) && stok.ttype != '\"') {
stok.nextToken();
String name = stok.sval;
@@ -147,64 +122,52 @@ and packages that are imported with this (ex "test.*") will be
stripped( and become "test." ). Here we need to test for this
and if necessary re-add the char.
*/
- if ( name != null )
- {
- if ( name.charAt( name.length() - 1 ) == '.' )
- {
+ if (name != null) {
+ if (name.charAt(name.length() - 1) == '.') {
name = name + '*';
}
- this.addImportType( new ImportType( name ) );
+ this.addImportType(new ImportType(name));
}
}
// Add the class or classes. There can be several classes in one file so
// continue with the while loop to get them all.
- if ( classTypes.contains( stok.sval ) && stok.ttype != '"' )
- {
+ if (classTypes.contains(stok.sval) && stok.ttype != '"') {
stok.nextToken();
- if ( stok.sval != null )
- {
- this.addClassType( new ClassType( nestedPrefix + stok.sval,
- getFilenameWithoutPathOrExtension( this.getPath() ) ) );
- parseRecursive( nestedPrefix + stok.sval + ".", stok );
+ if (stok.sval != null) {
+ this.addClassType(
+ new ClassType(nestedPrefix + stok.sval, getFilenameWithoutPathOrExtension(this.getPath())));
+ parseRecursive(nestedPrefix + stok.sval + ".", stok);
}
}
-
}
}
/**
* Gets a {@link StreamTokenizer} for this file.
*/
- private StreamTokenizer getTokenizer( Reader reader )
- {
- StreamTokenizer stok = new StreamTokenizer( reader );
+ private StreamTokenizer getTokenizer(Reader reader) {
+ StreamTokenizer stok = new StreamTokenizer(reader);
- stok.commentChar( '*' );
- stok.wordChars( '_', '_' );
+ stok.commentChar('*');
+ stok.wordChars('_', '_');
// set tokenizer to skip comments
- stok.slashStarComments( true );
- stok.slashSlashComments( true );
+ stok.slashStarComments(true);
+ stok.slashSlashComments(true);
return stok;
}
- private Reader getReader()
- throws IOException
- {
- if ( Files.notExists( this.getPath() ) )
- {
- throw new IOException( this.getPath() + " does not exist!" );
+ private Reader getReader() throws IOException {
+ if (Files.notExists(this.getPath())) {
+ throw new IOException(this.getPath() + " does not exist!");
}
- if ( this.getEncoding() != null )
- {
- return new InputStreamReader( new FileInputStream( this.getPath().toFile() ), this.getEncoding() );
- }
- else
- {
- return new FileReader( this.getPath().toFile() );
+ if (this.getEncoding() != null) {
+ return new InputStreamReader(new FileInputStream(this.getPath().toFile()), this.getEncoding());
+ } else {
+ return new FileReader(this.getPath().toFile());
}
}
}
diff --git a/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/PackageManager.java b/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/PackageManager.java
index 347d17fc..38d67c2f 100644
--- a/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/PackageManager.java
+++ b/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/PackageManager.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr.pacman;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,10 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-import org.codehaus.plexus.util.DirectoryScanner;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.maven.jxr.pacman;
import java.io.IOException;
import java.nio.file.Path;
@@ -31,13 +26,16 @@
import java.util.Map;
import java.util.Set;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Given a list of directories, parse them out and store them as rendered
* packages, classes, imports, etc.
*/
-public class PackageManager
-{
- private static final Logger LOGGER = LoggerFactory.getLogger( PackageManager.class );
+public class PackageManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(PackageManager.class);
private final FileManager fileManager;
@@ -53,7 +51,6 @@ public class PackageManager
*/
private PackageType defaultPackage = new PackageType();
-
/**
* The list of exclude patterns to use.
*/
@@ -62,10 +59,9 @@ public class PackageManager
/**
* The list of include patterns to use.
*/
- private String[] includes = { "**/*.java" };
+ private String[] includes = {"**/*.java"};
- public PackageManager( FileManager fileManager )
- {
+ public PackageManager(FileManager fileManager) {
this.fileManager = fileManager;
}
@@ -76,15 +72,13 @@ public PackageManager( FileManager fileManager )
* @param name name of package
* @return package type if found or default package type
*/
- public PackageType getPackageType( String name )
- {
- //return the default package if the name is null.
- if ( name == null )
- {
+ public PackageType getPackageType(String name) {
+ // return the default package if the name is null.
+ if (name == null) {
return defaultPackage;
}
- return this.packages.get( name );
+ return this.packages.get(name);
}
/**
@@ -92,9 +86,8 @@ public PackageType getPackageType( String name )
*
* @param packageType package type to add
*/
- public void addPackageType( PackageType packageType )
- {
- this.packages.put( packageType.getName(), packageType );
+ public void addPackageType(PackageType packageType) {
+ this.packages.put(packageType.getName(), packageType);
}
/**
@@ -102,101 +95,81 @@ public void addPackageType( PackageType packageType )
*
* @return package types
*/
- public Collection getPackageTypes()
- {
+ public Collection getPackageTypes() {
return packages.values();
}
/**
* Parse out all the directories on which this depends.
*/
- private void parse( Path baseDir )
- {
+ private void parse(Path baseDir) {
// Go through each directory and get the java source
// files for this dir.
- LOGGER.debug( "Scanning " + baseDir );
+ LOGGER.debug("Scanning " + baseDir);
DirectoryScanner directoryScanner = new DirectoryScanner();
- directoryScanner.setBasedir( baseDir.toFile() );
- directoryScanner.setExcludes( excludes );
- directoryScanner.setIncludes( includes );
+ directoryScanner.setBasedir(baseDir.toFile());
+ directoryScanner.setExcludes(excludes);
+ directoryScanner.setIncludes(includes);
directoryScanner.scan();
- for ( String file : directoryScanner.getIncludedFiles() )
- {
- LOGGER.debug( "parsing... " + file );
+ for (String file : directoryScanner.getIncludedFiles()) {
+ LOGGER.debug("parsing... " + file);
- //now parse out this file to get the packages/classname/etc
- try
- {
- Path fileName = baseDir.resolve( file );
- JavaFile jfi = fileManager.getFile( fileName );
+ // now parse out this file to get the packages/classname/etc
+ try {
+ Path fileName = baseDir.resolve(file);
+ JavaFile jfi = fileManager.getFile(fileName);
// now that we have this parsed out blend its information
// with the current package structure
- PackageType jp = this.getPackageType( jfi.getPackageType().getName() );
+ PackageType jp = this.getPackageType(jfi.getPackageType().getName());
- if ( jp == null )
- {
- this.addPackageType( jfi.getPackageType() );
+ if (jp == null) {
+ this.addPackageType(jfi.getPackageType());
jp = jfi.getPackageType();
}
// Add the current file's class(es) to this global package.
- if ( jfi.getClassTypes() != null && !jfi.getClassTypes().isEmpty() )
- {
- for ( ClassType ct : jfi.getClassTypes() )
- {
- jp.addClassType( ct );
+ if (jfi.getClassTypes() != null && !jfi.getClassTypes().isEmpty()) {
+ for (ClassType ct : jfi.getClassTypes()) {
+ jp.addClassType(ct);
}
}
- }
- catch ( IOException e )
- {
+ } catch (IOException e) {
e.printStackTrace();
}
-
}
-
}
- public void process( Path directory )
- {
- if ( this.directories.add( directory ) )
- {
- this.parse( directory );
+ public void process(Path directory) {
+ if (this.directories.add(directory)) {
+ this.parse(directory);
}
}
/**
* Dump the package information to STDOUT. FOR DEBUG ONLY
*/
- public void dump()
- {
+ public void dump() {
- LOGGER.debug( "Dumping out PackageManager structure" );
+ LOGGER.debug("Dumping out PackageManager structure");
- for ( PackageType current : getPackageTypes() )
- {
- LOGGER.debug( current.getName() );
+ for (PackageType current : getPackageTypes()) {
+ LOGGER.debug(current.getName());
- //get the classes under the package and print those too.
- for ( ClassType currentClass : current.getClassTypes() )
- {
- LOGGER.debug( '\t' + currentClass.getName() );
+ // get the classes under the package and print those too.
+ for (ClassType currentClass : current.getClassTypes()) {
+ LOGGER.debug('\t' + currentClass.getName());
}
}
}
- public void setExcludes( String[] excludes )
- {
+ public void setExcludes(String[] excludes) {
this.excludes = excludes;
}
-
- public void setIncludes( String[] includes )
- {
+ public void setIncludes(String[] includes) {
this.includes = includes;
}
}
-
diff --git a/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/PackageType.java b/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/PackageType.java
index 0920adbc..79a7266e 100644
--- a/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/PackageType.java
+++ b/maven-jxr/src/main/java/org/apache/maven/jxr/pacman/PackageType.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr.pacman;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.jxr.pacman;
import java.util.Collection;
import java.util.HashMap;
@@ -26,9 +25,7 @@
/**
* Represents a Java package and its subclasses.
*/
-public class PackageType
- extends BaseType
-{
+public class PackageType extends BaseType {
private Map classes = new HashMap<>();
@@ -37,17 +34,15 @@ public class PackageType
*
* @param name name of package
*/
- public PackageType( String name )
- {
- super( name );
+ public PackageType(String name) {
+ super(name);
}
/**
* Creates a Java package with no name IE the default Java package.
*/
- public PackageType()
- {
- super( "" );
+ public PackageType() {
+ super("");
}
/**
@@ -55,8 +50,7 @@ public PackageType()
*
* @return collection of class types
*/
- public Collection getClassTypes()
- {
+ public Collection getClassTypes() {
return classes.values();
}
@@ -65,11 +59,9 @@ public Collection getClassTypes()
*
* @param classType class type to add
*/
- public void addClassType( ClassType classType )
- {
-
- this.classes.put( classType.getName(), classType );
+ public void addClassType(ClassType classType) {
+ this.classes.put(classType.getName(), classType);
}
/**
@@ -79,10 +71,8 @@ public void addClassType( ClassType classType )
* @param classType class type String
* @return class type object
*/
- public ClassType getClassType( String classType )
- {
+ public ClassType getClassType(String classType) {
- return this.classes.get( classType );
+ return this.classes.get(classType);
}
-
}
diff --git a/maven-jxr/src/main/java/org/apache/maven/jxr/util/SimpleWordTokenizer.java b/maven-jxr/src/main/java/org/apache/maven/jxr/util/SimpleWordTokenizer.java
index db392f45..8b800fd9 100644
--- a/maven-jxr/src/main/java/org/apache/maven/jxr/util/SimpleWordTokenizer.java
+++ b/maven-jxr/src/main/java/org/apache/maven/jxr/util/SimpleWordTokenizer.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr.util;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.jxr.util;
import java.util.ArrayList;
import java.util.Collections;
@@ -30,12 +29,11 @@
* considers clear words that are only ended with spaces as strings. EX: "Flight" would be a word but "Flight()" would
* not.
*/
-public class SimpleWordTokenizer
-{
+public class SimpleWordTokenizer {
- private static final Pattern NONBREAKERS = Pattern.compile( "([^()\\[ {}]+)" );
+ private static final Pattern NONBREAKERS = Pattern.compile("([^()\\[ {}]+)");
- private static final char[] BREAKERS = { '(', ')', '[', ' ', '{', '}' };
+ private static final char[] BREAKERS = {'(', ')', '[', ' ', '{', '}'};
/**
* Breaks the given line into multiple tokens.
@@ -43,23 +41,21 @@ public class SimpleWordTokenizer
* @param line line to tokenize
* @return list of tokens
*/
- public static List tokenize( String line )
- {
+ public static List tokenize(String line) {
/*
* determine where to start processing this String... this could either be the start of the line or just keep
* going until the first
*/
- int start = getStart( line );
+ int start = getStart(line);
// find the first non-BREAKER char and assume that is where you want to start
- if ( line == null || line.length() == 0 || start == -1 )
- {
+ if (line == null || line.length() == 0 || start == -1) {
return Collections.emptyList();
}
- return tokenize( line, start );
+ return tokenize(line, start);
}
/**
@@ -69,19 +65,15 @@ public static List tokenize( String line )
* @param find String to match
* @return list of matching tokens
*/
- public static List tokenize( String line, String find )
- {
+ public static List tokenize(String line, String find) {
List foundTokens = new ArrayList<>();
- for ( StringEntry se : tokenize( line ) )
- {
+ for (StringEntry se : tokenize(line)) {
- if ( se.toString().equals( find ) )
- {
- foundTokens.add( se );
+ if (se.toString().equals(find)) {
+ foundTokens.add(se);
}
-
}
return foundTokens;
@@ -90,16 +82,14 @@ public static List tokenize( String line, String find )
/**
* Internal impl. Specify the start and end.
*/
- private static List tokenize( String line, int start )
- {
- Matcher matcher = NONBREAKERS.matcher( line.substring( start ) );
+ private static List tokenize(String line, int start) {
+ Matcher matcher = NONBREAKERS.matcher(line.substring(start));
List words = new ArrayList<>();
- while ( matcher.find() )
- {
- StringEntry entry = new StringEntry( matcher.group( 1 ), matcher.start() + start );
- words.add( entry );
+ while (matcher.find()) {
+ StringEntry entry = new StringEntry(matcher.group(1), matcher.start() + start);
+ words.add(entry);
}
return words;
@@ -108,17 +98,13 @@ private static List tokenize( String line, int start )
/**
* Go through the list of BREAKERS and find the closes one.
*/
- private static int getStart( String string )
- {
+ private static int getStart(String string) {
- for ( int i = 0; i < string.length(); ++i )
- {
+ for (int i = 0; i < string.length(); ++i) {
- if ( !isBreaker( string.charAt( i ) ) )
- {
+ if (!isBreaker(string.charAt(i))) {
return i;
}
-
}
return -1;
@@ -127,20 +113,15 @@ private static int getStart( String string )
/**
* Return true if the given char is considered a breaker.
*/
- private static boolean isBreaker( char c )
- {
+ private static boolean isBreaker(char c) {
- for ( char breaker : BREAKERS )
- {
+ for (char breaker : BREAKERS) {
- if ( breaker == c )
- {
+ if (breaker == c) {
return true;
}
-
}
return false;
}
-
}
diff --git a/maven-jxr/src/main/java/org/apache/maven/jxr/util/StringEntry.java b/maven-jxr/src/main/java/org/apache/maven/jxr/util/StringEntry.java
index 13c21c32..1da4b646 100644
--- a/maven-jxr/src/main/java/org/apache/maven/jxr/util/StringEntry.java
+++ b/maven-jxr/src/main/java/org/apache/maven/jxr/util/StringEntry.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr.util;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,13 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.jxr.util;
/**
* A StringEntry represents a value found by the tokenizer. The index is where
* this StringEntry was found in the source string.
*/
-public final class StringEntry
-{
+public final class StringEntry {
private final String value;
private final int index;
@@ -35,8 +33,7 @@ public final class StringEntry
* @param value value
* @param index index
*/
- public StringEntry( String value, int index )
- {
+ public StringEntry(String value, int index) {
this.value = value;
this.index = index;
}
@@ -46,15 +43,12 @@ public StringEntry( String value, int index )
*
* @return index
*/
- public int getIndex()
- {
+ public int getIndex() {
return this.index;
}
@Override
- public String toString()
- {
+ public String toString() {
return this.value;
}
-
}
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/DirectoryIndexerTest.java b/maven-jxr/src/test/java/org/apache/maven/jxr/DirectoryIndexerTest.java
index 23251763..fd6d9e65 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/DirectoryIndexerTest.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/DirectoryIndexerTest.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,9 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+package org.apache.maven.jxr;
import java.nio.file.Paths;
import java.util.Iterator;
@@ -34,55 +30,54 @@
import org.junit.Before;
import org.junit.Test;
-public class DirectoryIndexerTest
-{
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class DirectoryIndexerTest {
private DirectoryIndexer directoryIndexer;
-
+
@Before
- public void setUp()
- {
+ public void setUp() {
FileManager fileManager = new FileManager();
- PackageManager packageManager = new PackageManager( fileManager );
- packageManager.process( Paths.get( "src/test/resources/jxr68" ) );
+ PackageManager packageManager = new PackageManager(fileManager);
+ packageManager.process(Paths.get("src/test/resources/jxr68"));
- directoryIndexer = new DirectoryIndexer( packageManager, "" );
+ directoryIndexer = new DirectoryIndexer(packageManager, "");
}
-
+
/**
* Parse the files in test/resources/jxr68 packages, ensure all are present in the allClasses Map,
* in the correct order.
*/
@Test
- public void testJXR_68()
- {
+ public void testJXR_68() {
ProjectInfo packageInfo = directoryIndexer.getProjectInfo();
final Map allPackages = packageInfo.getAllPackages();
assertEquals(3, allPackages.size());
- assertTrue( allPackages.containsKey( "(default package)" ) );
- assertTrue( allPackages.containsKey( "pkga" ) );
- assertTrue( allPackages.containsKey( "pkgb" ) );
+ assertTrue(allPackages.containsKey("(default package)"));
+ assertTrue(allPackages.containsKey("pkga"));
+ assertTrue(allPackages.containsKey("pkgb"));
final Map allClasses = packageInfo.getAllClasses();
- assertEquals( 6, allClasses.size() );
+ assertEquals(6, allClasses.size());
final Iterator iterator = allClasses.values().iterator();
// #1: AClass
- assertEquals( "AClass", iterator.next().getName() );
+ assertEquals("AClass", iterator.next().getName());
// #2: BClass
- assertEquals( "BClass", iterator.next().getName() );
+ assertEquals("BClass", iterator.next().getName());
// #3: CClass
- assertEquals( "CClass", iterator.next().getName() );
+ assertEquals("CClass", iterator.next().getName());
// #4: SomeClass in default package
ClassInfo classInfo = iterator.next();
- assertEquals( "SomeClass", classInfo.getName() );
- assertEquals( ".", classInfo.getDir() );
+ assertEquals("SomeClass", classInfo.getName());
+ assertEquals(".", classInfo.getDir());
// #5: SomeClass in "pkga"
classInfo = iterator.next();
- assertEquals( "SomeClass", classInfo.getName() );
- assertEquals( "pkga", classInfo.getDir() );
+ assertEquals("SomeClass", classInfo.getName());
+ assertEquals("pkga", classInfo.getDir());
// #6: SomeClass in "pkgb"
classInfo = iterator.next();
- assertEquals( "SomeClass", classInfo.getName() );
- assertEquals( "pkgb", classInfo.getDir() );
+ assertEquals("SomeClass", classInfo.getName());
+ assertEquals("pkgb", classInfo.getDir());
}
-
-}
\ No newline at end of file
+}
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/IncludeExcludeTest.java b/maven-jxr/src/test/java/org/apache/maven/jxr/IncludeExcludeTest.java
index ca609323..22356ff6 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/IncludeExcludeTest.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/IncludeExcludeTest.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,9 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+package org.apache.maven.jxr;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -32,44 +28,42 @@
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
/**
* Test include/exclude patterns.
*
* @author Dennis Lundberg
*/
-public class IncludeExcludeTest
-{
+public class IncludeExcludeTest {
private JXR jxr;
@Before
- public void setUp()
- {
+ public void setUp() {
FileManager fileManager = new FileManager();
- PackageManager packageManager = new PackageManager( fileManager );
- JavaCodeTransform codeTransform = new JavaCodeTransform( packageManager, fileManager );
+ PackageManager packageManager = new PackageManager(fileManager);
+ JavaCodeTransform codeTransform = new JavaCodeTransform(packageManager, fileManager);
- jxr = new JXR( packageManager, codeTransform );
- jxr.setDest( Paths.get( "target" ) );
- jxr.setInputEncoding( "ISO-8859-1" );
- jxr.setOutputEncoding( "ISO-8859-1" );
- jxr.setJavadocLinkDir( Paths.get( "." ) );
+ jxr = new JXR(packageManager, codeTransform);
+ jxr.setDest(Paths.get("target"));
+ jxr.setInputEncoding("ISO-8859-1");
+ jxr.setOutputEncoding("ISO-8859-1");
+ jxr.setJavadocLinkDir(Paths.get("."));
}
@Test
- public void testIncludeExclude()
- throws Exception
- {
+ public void testIncludeExclude() throws Exception {
String[] excludes = {"**/exclude/ExcludedClass.java"};
- jxr.setExcludes( excludes );
+ jxr.setExcludes(excludes);
String[] includes = {"**/exclude/*.java", "**/include/IncludedClass.java"};
- jxr.setIncludes( includes );
- jxr.xref( Collections.singletonList( "src/test/resources" ), "templates/jdk4",
- "title", "title", "copyright" );
- Path excludedFile = Paths.get( "target/exclude/ExcludedClass.html" );
- assertFalse( Files.exists( excludedFile ) );
- Path includedFile = Paths.get( "target/include/IncludedClass.html" );
- assertTrue( Files.exists( includedFile ) );
- Path notIncludedFile = Paths.get( "target/include/NotIncludedClass.html" );
- assertFalse( Files.exists( notIncludedFile ) );
+ jxr.setIncludes(includes);
+ jxr.xref(Collections.singletonList("src/test/resources"), "templates/jdk4", "title", "title", "copyright");
+ Path excludedFile = Paths.get("target/exclude/ExcludedClass.html");
+ assertFalse(Files.exists(excludedFile));
+ Path includedFile = Paths.get("target/include/IncludedClass.html");
+ assertTrue(Files.exists(includedFile));
+ Path notIncludedFile = Paths.get("target/include/NotIncludedClass.html");
+ assertFalse(Files.exists(notIncludedFile));
}
}
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/JXR141Test.java b/maven-jxr/src/test/java/org/apache/maven/jxr/JXR141Test.java
index 6b04be36..2b1a6f03 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/JXR141Test.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/JXR141Test.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,9 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+package org.apache.maven.jxr;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@@ -33,51 +29,54 @@
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
/**
* Simple unit-testtest that illustrates a line with more
* than one "token" to replace
*/
-public class JXR141Test
-{
+public class JXR141Test {
private JXR jxr;
@Before
- public void setUp()
- {
+ public void setUp() {
FileManager fileManager = new FileManager();
- PackageManager packageManager = new PackageManager( fileManager );
- JavaCodeTransform codeTransform = new JavaCodeTransform( packageManager, fileManager );
-
- jxr = new JXR( packageManager, codeTransform );
+ PackageManager packageManager = new PackageManager(fileManager);
+ JavaCodeTransform codeTransform = new JavaCodeTransform(packageManager, fileManager);
+
+ jxr = new JXR(packageManager, codeTransform);
}
-
+
@Test
- public void testProcessPath() throws Exception
- {
- jxr.setDest( Paths.get("target/jxr-141" ) );
- jxr.setOutputEncoding( "UTF-8" );
- jxr.xref( Collections.singletonList( "src/test/resources/jxr141" ),"templates/jdk4",
- "title", "title", "copyright" );
+ public void testProcessPath() throws Exception {
+ jxr.setDest(Paths.get("target/jxr-141"));
+ jxr.setOutputEncoding("UTF-8");
+ jxr.xref(
+ Collections.singletonList("src/test/resources/jxr141"),
+ "templates/jdk4",
+ "title",
+ "title",
+ "copyright");
- List lines = Files.readAllLines( Paths.get( "target/jxr-141/Test141.html" ),
- StandardCharsets.UTF_8 );
+ List lines = Files.readAllLines(Paths.get("target/jxr-141/Test141.html"), StandardCharsets.UTF_8);
// Find line #27...
String line27 = null;
- for ( String line : lines )
- {
- if ( line.contains( "#L27" ) )
- {
+ for (String line : lines) {
+ if (line.contains("#L27")) {
line27 = line;
break;
}
}
-
- assertNotNull( "Line #27 not found - has source of Test141.java changed?", line27 );
- assertEquals( "27 " +
- "public static " +
- "final " +
- "Test141 instance = new " +
- "Test141();" , line27 );
+
+ assertNotNull("Line #27 not found - has source of Test141.java changed?", line27);
+ assertEquals(
+ "27 "
+ + "public static "
+ + "final "
+ + "Test141 instance = new "
+ + "Test141();",
+ line27);
}
-}
\ No newline at end of file
+}
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/JavaCodeTransformTest.java b/maven-jxr/src/test/java/org/apache/maven/jxr/JavaCodeTransformTest.java
index 8457aad8..84e46583 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/JavaCodeTransformTest.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/JavaCodeTransformTest.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.jxr;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@@ -35,16 +34,14 @@
/**
* JUnit test for {@link JavaCodeTransform}.
*/
-public class JavaCodeTransformTest
-{
+public class JavaCodeTransformTest {
/** JavaCodeTransform object under test */
private JavaCodeTransform codeTransform;
@Before
- public void setUp()
- {
+ public void setUp() {
FileManager fileManager = new FileManager();
- codeTransform = new JavaCodeTransform( new PackageManager( fileManager ), fileManager);
+ codeTransform = new JavaCodeTransform(new PackageManager(fileManager), fileManager);
}
/**
@@ -52,90 +49,110 @@ public void setUp()
*/
@Test
public void testTransform()
- //test transforms its own sourcefile, so add some comments
- throws Exception // single line despite /*
- {
- Path sourceFile = Paths.get( "src/test/java/org/apache/maven/jxr/JavaCodeTransformTest.java" );
- assertTrue( /* mid-line comment */ Files.exists( sourceFile ) ); /*
+ // test transforms its own sourcefile, so add some comments
+ throws Exception // single line despite /*
+ {
+ Path sourceFile = Paths.get("src/test/java/org/apache/maven/jxr/JavaCodeTransformTest.java");
+ assertTrue(/* mid-line comment */ Files.exists(sourceFile)); /*
multiline comment text
- */ codeTransform.transform( sourceFile, Paths.get( "target/JavaCodeTransformTest.html" ) // additional comment
- , Locale.ENGLISH, "ISO-8859-1", "ISO-8859-1", Paths.get( "./javadocs-test" ), "", "" );
- assertTrue( /**/ Files.exists( Paths.get( "target/JavaCodeTransformTest.html" ) ) );
-
- byte[] bytes = Files.readAllBytes( Paths.get( "target/JavaCodeTransformTest.html" ) );
- String content = new String( bytes, StandardCharsets.ISO_8859_1 );
- assertTrue( content.contains( "JavaCodeTransformTest xref" ) );
- assertTrue( content.contains( ""
- + "View Javadoc" ) );
+ */
+ codeTransform.transform(
+ sourceFile,
+ Paths.get("target/JavaCodeTransformTest.html") // additional comment
+ ,
+ Locale.ENGLISH,
+ "ISO-8859-1",
+ "ISO-8859-1",
+ Paths.get("./javadocs-test"),
+ "",
+ "");
+ assertTrue(/**/ Files.exists(Paths.get("target/JavaCodeTransformTest.html")));
+
+ byte[] bytes = Files.readAllBytes(Paths.get("target/JavaCodeTransformTest.html"));
+ String content = new String(bytes, StandardCharsets.ISO_8859_1);
+ assertTrue(content.contains("JavaCodeTransformTest xref"));
+ assertTrue(content.contains(
+ "" + "View Javadoc"));
}
/**
* Test what happens with an empty sourcefile.
*/
@Test
- public void testTransformWithEmptyClassFile()
- throws Exception
- {
- Path sourceFile = Paths.get( "src/test/resources/EmptyClass.java" );
- assertTrue( Files.exists( sourceFile ) );
-
- codeTransform.transform( sourceFile, Paths.get( "target/EmptyClass.html" )
- , Locale.ENGLISH, "ISO-8859-1", "ISO-8859-1", Paths.get( "javadocs" ), "", "" );
- assertTrue( Files.exists( Paths.get( "target/EmptyClass.html" ) ) );
-
- byte[] bytes = Files.readAllBytes( Paths.get( "target/EmptyClass.html" ) );
- String content = new String( bytes, StandardCharsets.ISO_8859_1 );
- assertTrue( content.contains( "EmptyClass xref" ) );
- assertTrue( content.contains( "View Javadoc" ) );
+ public void testTransformWithEmptyClassFile() throws Exception {
+ Path sourceFile = Paths.get("src/test/resources/EmptyClass.java");
+ assertTrue(Files.exists(sourceFile));
+
+ codeTransform.transform(
+ sourceFile,
+ Paths.get("target/EmptyClass.html"),
+ Locale.ENGLISH,
+ "ISO-8859-1",
+ "ISO-8859-1",
+ Paths.get("javadocs"),
+ "",
+ "");
+ assertTrue(Files.exists(Paths.get("target/EmptyClass.html")));
+
+ byte[] bytes = Files.readAllBytes(Paths.get("target/EmptyClass.html"));
+ String content = new String(bytes, StandardCharsets.ISO_8859_1);
+ assertTrue(content.contains("EmptyClass xref"));
+ assertTrue(content.contains("View Javadoc"));
}
/**
* Test proper handling of link
*/
@Test
- public void testLinkHandling()
- throws Exception
- {
- Path sourceFile = Paths.get( "src/test/resources/ClassWithLink.java" );
- assertTrue( Files.exists( sourceFile ) );
-
- codeTransform.transform( sourceFile, Paths.get( "target/ClassWithLink.html" )
- , Locale.ENGLISH, "ISO-8859-1", "ISO-8859-1", Paths.get( "." ), "", "" );
- assertTrue( Files.exists( Paths.get( "target/ClassWithLink.html" ) ) );
-
- byte[] bytes = Files.readAllBytes( Paths.get( "target/ClassWithLink.html" ) );
- String content = new String( bytes, StandardCharsets.ISO_8859_1 );
+ public void testLinkHandling() throws Exception {
+ Path sourceFile = Paths.get("src/test/resources/ClassWithLink.java");
+ assertTrue(Files.exists(sourceFile));
+
+ codeTransform.transform(
+ sourceFile,
+ Paths.get("target/ClassWithLink.html"),
+ Locale.ENGLISH,
+ "ISO-8859-1",
+ "ISO-8859-1",
+ Paths.get("."),
+ "",
+ "");
+ assertTrue(Files.exists(Paths.get("target/ClassWithLink.html")));
+
+ byte[] bytes = Files.readAllBytes(Paths.get("target/ClassWithLink.html"));
+ String content = new String(bytes, StandardCharsets.ISO_8859_1);
// The proper link in its full length
- assertTrue( content.contains(
- "http://www.apache.org/licenses/LICENSE-2.0" ) );
+ assertTrue(content.contains("http://www.apache.org/licenses/LICENSE-2.0"));
// ...and the same link with https protocol
- assertTrue( content.contains(
- "https://www.apache.org/licenses/LICENSE-2.0" ) );
-
+ assertTrue(content.contains("https://www.apache.org/licenses/LICENSE-2.0"));
}
/**
* Test what happens with unknown java type.
*/
@Test
- public void testTransformWithUnknownJavaType()
- throws Exception
- {
- Path sourceFile = Paths.get( "src/test/resources/UnknownType.java" );
- assertTrue( Files.exists( sourceFile ) );
-
- codeTransform.transform( sourceFile, Paths.get( "target/UnknownType.html" )
- , Locale.ENGLISH, "ISO-8859-1", "ISO-8859-1", Paths.get( "javadocs" ), "", "" );
- assertTrue( Files.exists( Paths.get( "target/UnknownType.html" ) ) );
-
- byte[] bytes = Files.readAllBytes( Paths.get( "target/UnknownType.html" ) );
- String content = new String( bytes, StandardCharsets.ISO_8859_1 );
- assertTrue( content.contains( "UnknownType xref" ) );
- assertTrue( content.contains( "View Javadoc" ) );
+ public void testTransformWithUnknownJavaType() throws Exception {
+ Path sourceFile = Paths.get("src/test/resources/UnknownType.java");
+ assertTrue(Files.exists(sourceFile));
+
+ codeTransform.transform(
+ sourceFile,
+ Paths.get("target/UnknownType.html"),
+ Locale.ENGLISH,
+ "ISO-8859-1",
+ "ISO-8859-1",
+ Paths.get("javadocs"),
+ "",
+ "");
+ assertTrue(Files.exists(Paths.get("target/UnknownType.html")));
+
+ byte[] bytes = Files.readAllBytes(Paths.get("target/UnknownType.html"));
+ String content = new String(bytes, StandardCharsets.ISO_8859_1);
+ assertTrue(content.contains("UnknownType xref"));
+ assertTrue(content.contains("View Javadoc"));
}
-
}
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/JxrBeanTest.java b/maven-jxr/src/test/java/org/apache/maven/jxr/JxrBeanTest.java
index 10c75492..3e688c8b 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/JxrBeanTest.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/JxrBeanTest.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.jxr;
import java.nio.file.Paths;
import java.util.Collections;
@@ -27,28 +26,23 @@
import org.junit.Before;
import org.junit.Test;
-public class JxrBeanTest
-{
+public class JxrBeanTest {
private JXR jxrBean;
@Before
- public void setUp()
- { FileManager fileManager = new FileManager();
- PackageManager packageManager = new PackageManager( fileManager );
- JavaCodeTransform codeTransform = new JavaCodeTransform( packageManager, fileManager );
- jxrBean = new JXR( packageManager, codeTransform );
- jxrBean.setDest( Paths.get( "target" ) );
- jxrBean.setInputEncoding( "ISO-8859-1" );
- jxrBean.setOutputEncoding( "ISO-8859-1" );
- jxrBean.setJavadocLinkDir( Paths.get( "." ) );
+ public void setUp() {
+ FileManager fileManager = new FileManager();
+ PackageManager packageManager = new PackageManager(fileManager);
+ JavaCodeTransform codeTransform = new JavaCodeTransform(packageManager, fileManager);
+ jxrBean = new JXR(packageManager, codeTransform);
+ jxrBean.setDest(Paths.get("target"));
+ jxrBean.setInputEncoding("ISO-8859-1");
+ jxrBean.setOutputEncoding("ISO-8859-1");
+ jxrBean.setJavadocLinkDir(Paths.get("."));
}
@Test
- public void testXref()
- throws Exception
- {
- jxrBean.xref( Collections.singletonList( "src/test/java" ), "templates/jdk4",
- "title", "title", "copyright" );
+ public void testXref() throws Exception {
+ jxrBean.xref(Collections.singletonList("src/test/java"), "templates/jdk4", "title", "title", "copyright");
}
-
}
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/pacman/JavaFileImplTest.java b/maven-jxr/src/test/java/org/apache/maven/jxr/pacman/JavaFileImplTest.java
index 1764bdab..e3032a77 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/pacman/JavaFileImplTest.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/pacman/JavaFileImplTest.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr.pacman;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,53 +16,56 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-import org.junit.Test;
+package org.apache.maven.jxr.pacman;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Iterator;
+import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
public class JavaFileImplTest {
@Test
- public void testJXR_135_lotsOfNested() throws IOException
- {
- JavaFileImpl javaFile = new JavaFileImpl( Paths.get(
- "src/test/resources/jxr135/org/apache/maven/jxr/pacman/ClassWithNested.java" ),
- "UTF-8" );
+ public void testJXR_135_lotsOfNested() throws IOException {
+ JavaFileImpl javaFile = new JavaFileImpl(
+ Paths.get("src/test/resources/jxr135/org/apache/maven/jxr/pacman/ClassWithNested.java"), "UTF-8");
final Iterator classTypes = javaFile.getClassTypes().iterator();
- assertEquals( "ClassWithNested", classTypes.next().getName() );
- assertEquals( "ClassWithNested.NestedInterface", classTypes.next().getName() );
- assertEquals( "ClassWithNested.NestedClassWithEnum", classTypes.next().getName() );
- assertEquals( "ClassWithNested.NestedClassWithEnum.NestedEnum", classTypes.next().getName() );
- assertEquals( "ClassWithNested.NestedClassWithEnum.NestedClass2", classTypes.next().getName() );
- assertEquals( "ClassWithNested.NestedClassWithEnum2", classTypes.next().getName() );
- assertEquals( "ClassWithNested.NestedClassWithEnum2.NestedEnum", classTypes.next().getName() );
- assertEquals( "ClassWithNested.NestedClassWithEnum2.NestedClass2", classTypes.next().getName() );
- assertEquals( "NotNested", classTypes.next().getName() );
+ assertEquals("ClassWithNested", classTypes.next().getName());
+ assertEquals("ClassWithNested.NestedInterface", classTypes.next().getName());
+ assertEquals("ClassWithNested.NestedClassWithEnum", classTypes.next().getName());
+ assertEquals(
+ "ClassWithNested.NestedClassWithEnum.NestedEnum",
+ classTypes.next().getName());
+ assertEquals(
+ "ClassWithNested.NestedClassWithEnum.NestedClass2",
+ classTypes.next().getName());
+ assertEquals("ClassWithNested.NestedClassWithEnum2", classTypes.next().getName());
+ assertEquals(
+ "ClassWithNested.NestedClassWithEnum2.NestedEnum",
+ classTypes.next().getName());
+ assertEquals(
+ "ClassWithNested.NestedClassWithEnum2.NestedClass2",
+ classTypes.next().getName());
+ assertEquals("NotNested", classTypes.next().getName());
}
@Test
- public void testJXR_170_multiLineString() throws IOException
- {
- JavaFileImpl javaFile = new JavaFileImpl( Paths.get(
- "src/test/resources/jxr170/org/apache/maven/jxr/pacman/ClassWithMultiLineString.java" ),
- "UTF-8" );
- assertEquals( 1, javaFile.getClassTypes().size() );
- assertEquals( "ClassWithMultiLineString", javaFile.getClassTypes().get(0).getName() );
- assertEquals( "[ImportType[name=java.lang.*]]", javaFile.getImportTypes().toString() );
+ public void testJXR_170_multiLineString() throws IOException {
+ JavaFileImpl javaFile = new JavaFileImpl(
+ Paths.get("src/test/resources/jxr170/org/apache/maven/jxr/pacman/ClassWithMultiLineString.java"),
+ "UTF-8");
+ assertEquals(1, javaFile.getClassTypes().size());
+ assertEquals("ClassWithMultiLineString", javaFile.getClassTypes().get(0).getName());
+ assertEquals("[ImportType[name=java.lang.*]]", javaFile.getImportTypes().toString());
}
@Test
- public void testJXR_175_java14Record() throws IOException
- {
- JavaFileImpl javaFile = new JavaFileImpl( Paths.get(
- "src/test/resources/jxr175/org/apache/maven/jxr/pacman/Java14Record.java" ),
- "UTF-8" );
- assertEquals( 1, javaFile.getClassTypes().size() );
- assertEquals( "Java14Record", javaFile.getClassTypes().get(0).getName() );
+ public void testJXR_175_java14Record() throws IOException {
+ JavaFileImpl javaFile = new JavaFileImpl(
+ Paths.get("src/test/resources/jxr175/org/apache/maven/jxr/pacman/Java14Record.java"), "UTF-8");
+ assertEquals(1, javaFile.getClassTypes().size());
+ assertEquals("Java14Record", javaFile.getClassTypes().get(0).getName());
}
-
}
diff --git a/maven-jxr/src/test/java/org/apache/maven/jxr/util/SimpleWordTokenizerTest.java b/maven-jxr/src/test/java/org/apache/maven/jxr/util/SimpleWordTokenizerTest.java
index 16a5ec11..6f2d7c23 100644
--- a/maven-jxr/src/test/java/org/apache/maven/jxr/util/SimpleWordTokenizerTest.java
+++ b/maven-jxr/src/test/java/org/apache/maven/jxr/util/SimpleWordTokenizerTest.java
@@ -1,5 +1,3 @@
-package org.apache.maven.jxr.util;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,109 +16,104 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-import static org.junit.Assert.assertEquals;
+package org.apache.maven.jxr.util;
import java.util.List;
import org.junit.Test;
-public class SimpleWordTokenizerTest
-{
+import static org.junit.Assert.assertEquals;
+
+public class SimpleWordTokenizerTest {
@Test
- public void testCompact()
- {
- List entries = SimpleWordTokenizer.tokenize( "public void withApp1(App app)" );
- assertEquals( 5, entries.size() );
+ public void testCompact() {
+ List entries = SimpleWordTokenizer.tokenize("public void withApp1(App app)");
+ assertEquals(5, entries.size());
- assertEquals( "public", entries.get(0).toString() );
- assertEquals( 0, entries.get(0).getIndex() );
+ assertEquals("public", entries.get(0).toString());
+ assertEquals(0, entries.get(0).getIndex());
- assertEquals( "void", entries.get(1).toString() );
- assertEquals( 7, entries.get(1).getIndex() );
+ assertEquals("void", entries.get(1).toString());
+ assertEquals(7, entries.get(1).getIndex());
- assertEquals( "withApp1", entries.get(2).toString() );
- assertEquals( 12, entries.get(2).getIndex() );
+ assertEquals("withApp1", entries.get(2).toString());
+ assertEquals(12, entries.get(2).getIndex());
- assertEquals( "App", entries.get(3).toString() );
- assertEquals( 21, entries.get(3).getIndex() );
+ assertEquals("App", entries.get(3).toString());
+ assertEquals(21, entries.get(3).getIndex());
- assertEquals( "app", entries.get(4).toString() );
- assertEquals( 25, entries.get(4).getIndex() );
+ assertEquals("app", entries.get(4).toString());
+ assertEquals(25, entries.get(4).getIndex());
}
-
+
@Test
- public void testSpacesAroundParenOpen()
- {
- List entries = SimpleWordTokenizer.tokenize( "public void withApp2 ( App app)" );
- assertEquals( 5, entries.size() );
+ public void testSpacesAroundParenOpen() {
+ List entries = SimpleWordTokenizer.tokenize("public void withApp2 ( App app)");
+ assertEquals(5, entries.size());
- assertEquals( "public", entries.get(0).toString() );
- assertEquals( 0, entries.get(0).getIndex() );
+ assertEquals("public", entries.get(0).toString());
+ assertEquals(0, entries.get(0).getIndex());
- assertEquals( "void", entries.get(1).toString() );
- assertEquals( 7, entries.get(1).getIndex() );
+ assertEquals("void", entries.get(1).toString());
+ assertEquals(7, entries.get(1).getIndex());
- assertEquals( "withApp2", entries.get(2).toString() );
- assertEquals( 12, entries.get(2).getIndex() );
+ assertEquals("withApp2", entries.get(2).toString());
+ assertEquals(12, entries.get(2).getIndex());
- assertEquals( "App", entries.get(3).toString() );
- assertEquals( 23, entries.get(3).getIndex() );
+ assertEquals("App", entries.get(3).toString());
+ assertEquals(23, entries.get(3).getIndex());
- assertEquals( "app", entries.get(4).toString() );
- assertEquals( 27, entries.get(4).getIndex() );
+ assertEquals("app", entries.get(4).toString());
+ assertEquals(27, entries.get(4).getIndex());
}
@Test
- public void testSpaceBeforeParenOpen()
- {
- List entries = SimpleWordTokenizer.tokenize( "public void withApp3 (App app)" );
- assertEquals( 5, entries.size() );
+ public void testSpaceBeforeParenOpen() {
+ List entries = SimpleWordTokenizer.tokenize("public void withApp3 (App app)");
+ assertEquals(5, entries.size());
- assertEquals( "public", entries.get(0).toString() );
- assertEquals( 0, entries.get(0).getIndex() );
+ assertEquals("public", entries.get(0).toString());
+ assertEquals(0, entries.get(0).getIndex());
- assertEquals( "void", entries.get(1).toString() );
- assertEquals( 7, entries.get(1).getIndex() );
+ assertEquals("void", entries.get(1).toString());
+ assertEquals(7, entries.get(1).getIndex());
- assertEquals( "withApp3", entries.get(2).toString() );
- assertEquals( 12, entries.get(2).getIndex() );
+ assertEquals("withApp3", entries.get(2).toString());
+ assertEquals(12, entries.get(2).getIndex());
- assertEquals( "App", entries.get(3).toString() );
- assertEquals( 22, entries.get(3).getIndex() );
+ assertEquals("App", entries.get(3).toString());
+ assertEquals(22, entries.get(3).getIndex());
- assertEquals( "app", entries.get(4).toString() );
- assertEquals( 26, entries.get(4).getIndex() );
+ assertEquals("app", entries.get(4).toString());
+ assertEquals(26, entries.get(4).getIndex());
}
@Test
- public void testSpaceAfterParenOpen()
- {
- List entries = SimpleWordTokenizer.tokenize( "public void withApp4( App app)" );
- assertEquals( 5, entries.size() );
+ public void testSpaceAfterParenOpen() {
+ List entries = SimpleWordTokenizer.tokenize("public void withApp4( App app)");
+ assertEquals(5, entries.size());
- assertEquals( "public", entries.get(0).toString() );
- assertEquals( 0, entries.get(0).getIndex() );
+ assertEquals("public", entries.get(0).toString());
+ assertEquals(0, entries.get(0).getIndex());
- assertEquals( "void", entries.get(1).toString() );
- assertEquals( 7, entries.get(1).getIndex() );
+ assertEquals("void", entries.get(1).toString());
+ assertEquals(7, entries.get(1).getIndex());
- assertEquals( "withApp4", entries.get(2).toString() );
- assertEquals( 12, entries.get(2).getIndex() );
+ assertEquals("withApp4", entries.get(2).toString());
+ assertEquals(12, entries.get(2).getIndex());
- assertEquals( "App", entries.get(3).toString() );
- assertEquals( 22, entries.get(3).getIndex() );
+ assertEquals("App", entries.get(3).toString());
+ assertEquals(22, entries.get(3).getIndex());
- assertEquals( "app", entries.get(4).toString() );
- assertEquals( 26, entries.get(4).getIndex() );
+ assertEquals("app", entries.get(4).toString());
+ assertEquals(26, entries.get(4).getIndex());
}
-
+
@Test
- public void testWithIndent()
- {
- List entries = SimpleWordTokenizer.tokenize( " public void withApp3 (App app)", "App" );
- assertEquals( 1, entries.size() );
-
- assertEquals( 26, entries.get(0).getIndex() );
+ public void testWithIndent() {
+ List entries = SimpleWordTokenizer.tokenize(" public void withApp3 (App app)", "App");
+ assertEquals(1, entries.size());
+
+ assertEquals(26, entries.get(0).getIndex());
}
-}
\ No newline at end of file
+}
diff --git a/pom.xml b/pom.xml
index ed21e8bc..ea98f25f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,4 @@
-
-
4.0.0
org.apache.maven
maven-parent
- 37
+ 39
@@ -36,15 +34,29 @@ under the License.
Maven JXR Parent
+ Source cross reference library
+
https://maven.apache.org/jxr/
- Source cross reference library
+
+
+ Alina Vasiljeva
+
+
+ Jesper Udby
+
+
+
+
+ maven-jxr
+ maven-jxr-plugin
+
scm:git:https://gitbox.apache.org/repos/asf/maven-jxr.git
scm:git:https://gitbox.apache.org/repos/asf/maven-jxr.git
- https://github.com/apache/maven-jxr/tree/${project.scm.tag}
HEAD
+ https://github.com/apache/maven-jxr/tree/${project.scm.tag}
@@ -72,20 +84,6 @@ under the License.
2022-08-16T10:28:45Z
-
- maven-jxr
- maven-jxr-plugin
-
-
-
-
- Alina Vasiljeva
-
-
- Jesper Udby
-
-
-
@@ -180,9 +178,9 @@ under the License.
aggregate
-
+
-
+