mirror of https://github.com/apache/maven.git
fixed errors reported by Checkstyle
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@813627 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a1803e5a48
commit
05b59c8935
|
@ -39,28 +39,28 @@ public interface ModelBuildingRequest
|
|||
* Denotes minimal validation of POMs. This validation level is meant for processing of POMs from repositories
|
||||
* during metadata retrieval.
|
||||
*/
|
||||
static final int VALIDATION_LEVEL_MINIMAL = 0;
|
||||
int VALIDATION_LEVEL_MINIMAL = 0;
|
||||
|
||||
/**
|
||||
* Denotes validation as performed by Maven 2.0. This validation level is meant as a compatibility mode to allow
|
||||
* users to migrate their projects.
|
||||
*/
|
||||
static final int VALIDATION_LEVEL_MAVEN_2_0 = 20;
|
||||
int VALIDATION_LEVEL_MAVEN_2_0 = 20;
|
||||
|
||||
/**
|
||||
* Denotes validation as performed by Maven 3.0. This validation level is meant for existing projects.
|
||||
*/
|
||||
static final int VALIDATION_LEVEL_MAVEN_3_0 = 30;
|
||||
int VALIDATION_LEVEL_MAVEN_3_0 = 30;
|
||||
|
||||
/**
|
||||
* Denotes validation as performed by Maven 3.1. This validation level is meant for new projects.
|
||||
*/
|
||||
static final int VALIDATION_LEVEL_MAVEN_3_1 = 31;
|
||||
int VALIDATION_LEVEL_MAVEN_3_1 = 31;
|
||||
|
||||
/**
|
||||
* Denotes strict validation as recommended by the current Maven version.
|
||||
*/
|
||||
static final int VALIDATION_LEVEL_STRICT = VALIDATION_LEVEL_MAVEN_3_0;
|
||||
int VALIDATION_LEVEL_STRICT = VALIDATION_LEVEL_MAVEN_3_0;
|
||||
|
||||
/**
|
||||
* Gets the source of the POM to process.
|
||||
|
|
|
@ -67,7 +67,7 @@ interface ModelCacheTag<T>
|
|||
/**
|
||||
* The tag used to denote raw model data.
|
||||
*/
|
||||
public static final ModelCacheTag<ModelData> RAW = new ModelCacheTag<ModelData>()
|
||||
ModelCacheTag<ModelData> RAW = new ModelCacheTag<ModelData>()
|
||||
{
|
||||
|
||||
public String getName()
|
||||
|
@ -96,7 +96,7 @@ interface ModelCacheTag<T>
|
|||
/**
|
||||
* The tag used to denote an effective dependency management section from an imported model.
|
||||
*/
|
||||
public static final ModelCacheTag<DependencyManagement> IMPORT = new ModelCacheTag<DependencyManagement>()
|
||||
ModelCacheTag<DependencyManagement> IMPORT = new ModelCacheTag<DependencyManagement>()
|
||||
{
|
||||
|
||||
public String getName()
|
||||
|
|
|
@ -1,11 +1,30 @@
|
|||
package org.apache.maven.model.building;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
|
||||
|
||||
public interface ModelEventListener {
|
||||
public interface ModelEventListener
|
||||
{
|
||||
|
||||
void fire(Model model);
|
||||
void fire( Model model );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -121,9 +121,8 @@ public class DefaultInheritanceAssembler
|
|||
List<Plugin> tgt = target.getPlugins();
|
||||
Map<Object, Plugin> merged = new LinkedHashMap<Object, Plugin>( ( src.size() + tgt.size() ) * 2 );
|
||||
|
||||
for ( Iterator<Plugin> it = src.iterator(); it.hasNext(); )
|
||||
for ( Plugin element : src )
|
||||
{
|
||||
Plugin element = it.next();
|
||||
Object key = getPluginKey( element );
|
||||
if ( element.isInherited() )
|
||||
{
|
||||
|
@ -137,9 +136,8 @@ public class DefaultInheritanceAssembler
|
|||
}
|
||||
}
|
||||
|
||||
for ( Iterator<Plugin> it = tgt.iterator(); it.hasNext(); )
|
||||
for ( Plugin element : tgt )
|
||||
{
|
||||
Plugin element = it.next();
|
||||
Object key = getPluginKey( element );
|
||||
Plugin existing = merged.get( key );
|
||||
if ( existing != null )
|
||||
|
@ -164,9 +162,8 @@ public class DefaultInheritanceAssembler
|
|||
Map<Object, ReportPlugin> merged =
|
||||
new LinkedHashMap<Object, ReportPlugin>( ( src.size() + tgt.size() ) * 2 );
|
||||
|
||||
for ( Iterator<ReportPlugin> it = src.iterator(); it.hasNext(); )
|
||||
for ( ReportPlugin element : src )
|
||||
{
|
||||
ReportPlugin element = it.next();
|
||||
Object key = getReportPluginKey( element );
|
||||
if ( element.isInherited() )
|
||||
{
|
||||
|
@ -180,9 +177,8 @@ public class DefaultInheritanceAssembler
|
|||
}
|
||||
}
|
||||
|
||||
for ( Iterator<ReportPlugin> it = tgt.iterator(); it.hasNext(); )
|
||||
for ( ReportPlugin element : tgt )
|
||||
{
|
||||
ReportPlugin element = it.next();
|
||||
Object key = getReportPluginKey( element );
|
||||
ReportPlugin existing = merged.get( key );
|
||||
if ( existing != null )
|
||||
|
|
|
@ -197,7 +197,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
|||
}
|
||||
|
||||
String result = src;
|
||||
synchronized( this )
|
||||
synchronized ( this )
|
||||
{
|
||||
|
||||
for ( ValueSource vs : valueSources )
|
||||
|
|
|
@ -108,7 +108,7 @@ public class StringSearchModelInterpolator
|
|||
|
||||
public Object run()
|
||||
{
|
||||
while( !interpolationTargets.isEmpty() )
|
||||
while ( !interpolationTargets.isEmpty() )
|
||||
{
|
||||
Object obj = interpolationTargets.removeFirst();
|
||||
|
||||
|
@ -176,7 +176,7 @@ public class StringSearchModelInterpolator
|
|||
{
|
||||
c.clear();
|
||||
}
|
||||
catch( UnsupportedOperationException e )
|
||||
catch ( UnsupportedOperationException e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public class StringSearchModelInterpolator
|
|||
{
|
||||
if ( value != null )
|
||||
{
|
||||
if( String.class == value.getClass() )
|
||||
if ( String.class == value.getClass() )
|
||||
{
|
||||
String interpolated =
|
||||
modelInterpolator.interpolateInternal( (String) value,
|
||||
|
@ -233,7 +233,7 @@ public class StringSearchModelInterpolator
|
|||
|
||||
if ( value != null )
|
||||
{
|
||||
if( String.class == value.getClass() )
|
||||
if ( String.class == value.getClass() )
|
||||
{
|
||||
String interpolated =
|
||||
modelInterpolator.interpolateInternal( (String) value,
|
||||
|
@ -246,7 +246,7 @@ public class StringSearchModelInterpolator
|
|||
{
|
||||
entry.setValue( interpolated );
|
||||
}
|
||||
catch( UnsupportedOperationException e )
|
||||
catch ( UnsupportedOperationException e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ public class StringSearchModelInterpolator
|
|||
private void evaluateArray( Object target )
|
||||
{
|
||||
int len = Array.getLength( target );
|
||||
for( int i = 0; i < len; i++ )
|
||||
for ( int i = 0; i < len; i++ )
|
||||
{
|
||||
Object value = Array.get( target, i );
|
||||
if ( value != null )
|
||||
|
|
|
@ -39,7 +39,7 @@ public interface ModelReader
|
|||
* The key for the option to enable strict parsing. This option is of type {@link Boolean} and defaults to {@code
|
||||
* true}. If {@code false}, unknown elements will be ignored instead of causing a failure.
|
||||
*/
|
||||
static final String IS_STRICT = "org.apache.maven.model.io.isStrict";
|
||||
String IS_STRICT = "org.apache.maven.model.io.isStrict";
|
||||
|
||||
/**
|
||||
* Reads the model from the specified file.
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.maven.model.management;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -90,9 +89,8 @@ public class DefaultDependencyManagementInjector
|
|||
{
|
||||
List<Exclusion> src = source.getExclusions();
|
||||
|
||||
for ( Iterator<Exclusion> it = src.iterator(); it.hasNext(); )
|
||||
for ( Exclusion element : src )
|
||||
{
|
||||
Exclusion element = it.next();
|
||||
Exclusion clone = new Exclusion();
|
||||
mergeExclusion( clone, element, true, context );
|
||||
target.addExclusion( clone );
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.maven.model.management;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -82,16 +81,14 @@ public class DefaultPluginManagementInjector
|
|||
|
||||
Map<Object, Object> context = Collections.emptyMap();
|
||||
|
||||
for ( Iterator<Plugin> it = src.iterator(); it.hasNext(); )
|
||||
for ( Plugin element : src )
|
||||
{
|
||||
Plugin element = it.next();
|
||||
Object key = getPluginKey( element );
|
||||
managedPlugins.put( key, element );
|
||||
}
|
||||
|
||||
for ( Iterator<Plugin> it = tgt.iterator(); it.hasNext(); )
|
||||
for ( Plugin element : tgt )
|
||||
{
|
||||
Plugin element = it.next();
|
||||
Object key = getPluginKey( element );
|
||||
Plugin managedPlugin = managedPlugins.get( key );
|
||||
if ( managedPlugin != null )
|
||||
|
@ -114,18 +111,16 @@ public class DefaultPluginManagementInjector
|
|||
Map<Object, PluginExecution> merged =
|
||||
new LinkedHashMap<Object, PluginExecution>( ( src.size() + tgt.size() ) * 2 );
|
||||
|
||||
for ( Iterator<PluginExecution> it = src.iterator(); it.hasNext(); )
|
||||
for ( PluginExecution element : src )
|
||||
{
|
||||
PluginExecution element = it.next();
|
||||
Object key = getPluginExecutionKey( element );
|
||||
PluginExecution clone = new PluginExecution();
|
||||
mergePluginExecution( clone, element, true, context );
|
||||
merged.put( key, clone );
|
||||
}
|
||||
|
||||
for ( Iterator<PluginExecution> it = tgt.iterator(); it.hasNext(); )
|
||||
for ( PluginExecution element : tgt )
|
||||
{
|
||||
PluginExecution element = it.next();
|
||||
Object key = getPluginExecutionKey( element );
|
||||
PluginExecution existing = merged.get( key );
|
||||
if ( existing != null )
|
||||
|
|
|
@ -124,7 +124,8 @@ public class MavenModelMerger
|
|||
Organization tgt = target.getOrganization();
|
||||
if ( tgt == null )
|
||||
{
|
||||
target.setOrganization( tgt = new Organization() );
|
||||
tgt = new Organization();
|
||||
target.setOrganization( tgt );
|
||||
mergeOrganization( tgt, src, sourceDominant, context );
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +141,8 @@ public class MavenModelMerger
|
|||
IssueManagement tgt = target.getIssueManagement();
|
||||
if ( tgt == null )
|
||||
{
|
||||
target.setIssueManagement( tgt = new IssueManagement() );
|
||||
tgt = new IssueManagement();
|
||||
target.setIssueManagement( tgt );
|
||||
mergeIssueManagement( tgt, src, sourceDominant, context );
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +158,8 @@ public class MavenModelMerger
|
|||
CiManagement tgt = target.getCiManagement();
|
||||
if ( tgt == null )
|
||||
{
|
||||
target.setCiManagement( tgt = new CiManagement() );
|
||||
tgt = new CiManagement();
|
||||
target.setCiManagement( tgt );
|
||||
mergeCiManagement( tgt, src, sourceDominant, context );
|
||||
}
|
||||
}
|
||||
|
@ -261,16 +264,14 @@ public class MavenModelMerger
|
|||
recessive = src;
|
||||
}
|
||||
|
||||
for ( Iterator<Repository> it = dominant.iterator(); it.hasNext(); )
|
||||
for ( Repository element : dominant )
|
||||
{
|
||||
Repository element = it.next();
|
||||
Object key = getRepositoryKey( element );
|
||||
merged.put( key, element );
|
||||
}
|
||||
|
||||
for ( Iterator<Repository> it = recessive.iterator(); it.hasNext(); )
|
||||
for ( Repository element : recessive )
|
||||
{
|
||||
Repository element = it.next();
|
||||
Object key = getRepositoryKey( element );
|
||||
if ( !merged.containsKey( key ) )
|
||||
{
|
||||
|
@ -338,7 +339,8 @@ public class MavenModelMerger
|
|||
DeploymentRepository tgt = target.getRepository();
|
||||
if ( tgt == null )
|
||||
{
|
||||
target.setRepository( tgt = new DeploymentRepository() );
|
||||
tgt = new DeploymentRepository();
|
||||
target.setRepository( tgt );
|
||||
mergeDeploymentRepository( tgt, src, sourceDominant, context );
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +357,8 @@ public class MavenModelMerger
|
|||
DeploymentRepository tgt = target.getSnapshotRepository();
|
||||
if ( tgt == null )
|
||||
{
|
||||
target.setSnapshotRepository( tgt = new DeploymentRepository() );
|
||||
tgt = new DeploymentRepository();
|
||||
target.setSnapshotRepository( tgt );
|
||||
mergeDeploymentRepository( tgt, src, sourceDominant, context );
|
||||
}
|
||||
}
|
||||
|
@ -371,7 +374,8 @@ public class MavenModelMerger
|
|||
Site tgt = target.getSite();
|
||||
if ( tgt == null )
|
||||
{
|
||||
target.setSite( tgt = new Site() );
|
||||
tgt = new Site();
|
||||
target.setSite( tgt );
|
||||
mergeSite( tgt, src, sourceDominant, context );
|
||||
}
|
||||
}
|
||||
|
@ -461,9 +465,8 @@ public class MavenModelMerger
|
|||
Map<Object, PluginExecution> merged =
|
||||
new LinkedHashMap<Object, PluginExecution>( ( src.size() + tgt.size() ) * 2 );
|
||||
|
||||
for ( Iterator<PluginExecution> it = src.iterator(); it.hasNext(); )
|
||||
for ( PluginExecution element : src )
|
||||
{
|
||||
PluginExecution element = it.next();
|
||||
if ( sourceDominant || ( source.isInherited() && element.isInherited() ) )
|
||||
{
|
||||
Object key = getPluginExecutionKey( element );
|
||||
|
@ -471,9 +474,8 @@ public class MavenModelMerger
|
|||
}
|
||||
}
|
||||
|
||||
for ( Iterator<PluginExecution> it = tgt.iterator(); it.hasNext(); )
|
||||
for ( PluginExecution element : tgt )
|
||||
{
|
||||
PluginExecution element = it.next();
|
||||
Object key = getPluginExecutionKey( element );
|
||||
PluginExecution existing = merged.get( key );
|
||||
if ( existing != null )
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.maven.model.profile;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -94,16 +93,14 @@ public class DefaultProfileInjector
|
|||
List<Plugin> tgt = target.getPlugins();
|
||||
Map<Object, Plugin> merged = new LinkedHashMap<Object, Plugin>( ( src.size() + tgt.size() ) * 2 );
|
||||
|
||||
for ( Iterator<Plugin> it = tgt.iterator(); it.hasNext(); )
|
||||
for ( Plugin element : tgt )
|
||||
{
|
||||
Plugin element = it.next();
|
||||
Object key = getPluginKey( element );
|
||||
merged.put( key, element );
|
||||
}
|
||||
|
||||
for ( Iterator<Plugin> it = src.iterator(); it.hasNext(); )
|
||||
for ( Plugin element : src )
|
||||
{
|
||||
Plugin element = it.next();
|
||||
Object key = getPluginKey( element );
|
||||
Plugin existing = merged.get( key );
|
||||
if ( existing == null )
|
||||
|
@ -131,16 +128,14 @@ public class DefaultProfileInjector
|
|||
Map<Object, ReportPlugin> merged =
|
||||
new LinkedHashMap<Object, ReportPlugin>( ( src.size() + tgt.size() ) * 2 );
|
||||
|
||||
for ( Iterator<ReportPlugin> it = tgt.iterator(); it.hasNext(); )
|
||||
for ( ReportPlugin element : tgt )
|
||||
{
|
||||
ReportPlugin element = it.next();
|
||||
Object key = getReportPluginKey( element );
|
||||
merged.put( key, element );
|
||||
}
|
||||
|
||||
for ( Iterator<ReportPlugin> it = src.iterator(); it.hasNext(); )
|
||||
for ( ReportPlugin element : src )
|
||||
{
|
||||
ReportPlugin element = it.next();
|
||||
Object key = getReportPluginKey( element );
|
||||
ReportPlugin existing = merged.get( key );
|
||||
if ( existing == null )
|
||||
|
|
|
@ -121,15 +121,15 @@ public class DefaultModelValidator
|
|||
|
||||
if ( !model.getModules().isEmpty() && !"pom".equals( model.getPackaging() ) )
|
||||
{
|
||||
addViolation( problems, false, "Packaging '" + model.getPackaging() + "' is invalid. Aggregator projects " +
|
||||
"require 'pom' as packaging." );
|
||||
addViolation( problems, false, "Packaging '" + model.getPackaging() + "' is invalid. Aggregator projects "
|
||||
+ "require 'pom' as packaging." );
|
||||
}
|
||||
|
||||
Parent parent = model.getParent();
|
||||
if ( parent != null )
|
||||
{
|
||||
if ( parent.getGroupId().equals( model.getGroupId() ) &&
|
||||
parent.getArtifactId().equals( model.getArtifactId() ) )
|
||||
if ( parent.getGroupId().equals( model.getGroupId() )
|
||||
&& parent.getArtifactId().equals( model.getArtifactId() ) )
|
||||
{
|
||||
addViolation( problems, false, "The parent element cannot have the same ID as the project." );
|
||||
}
|
||||
|
@ -163,8 +163,8 @@ public class DefaultModelValidator
|
|||
{
|
||||
if ( !new File( systemPath ).isAbsolute() )
|
||||
{
|
||||
addViolation( problems, false, "For dependency " + d + ": system-scoped dependency must " +
|
||||
"specify an absolute path systemPath." );
|
||||
addViolation( problems, false, "For dependency " + d + ": system-scoped dependency must "
|
||||
+ "specify an absolute path systemPath." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -208,8 +208,8 @@ public class DefaultModelValidator
|
|||
{
|
||||
if ( !new File( systemPath ).isAbsolute() )
|
||||
{
|
||||
addViolation( problems, false, "For managed dependency " + d + ": system-scoped dependency must " +
|
||||
"specify an absolute path systemPath." );
|
||||
addViolation( problems, false, "For managed dependency " + d + ": system-scoped dependency must "
|
||||
+ "specify an absolute path systemPath." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue