Skip to content

Commits on Source 3

target/
.project
.classpath
.settings/
.svn/
bin/
# Intellij
*.ipr
*.iml
.idea
out/
.DS_Store
/bootstrap
/dependencies.xml
.java-version
/**
* 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.
*/
asfMavenTlpStdBuild()
......@@ -24,13 +24,13 @@
<parent>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-components</artifactId>
<version>30</version>
<version>31</version>
<relativePath>../../pom/maven/maven-shared-components/pom.xml</relativePath>
</parent>
<artifactId>maven-dependency-analyzer</artifactId>
<packaging>jar</packaging>
<version>1.7</version>
<version>1.10</version>
<name>Apache Maven Dependency Analyzer</name>
<description>
......@@ -38,14 +38,19 @@
</description>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/maven/shared/tags/maven-dependency-analyzer-1.7</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/shared/tags/maven-dependency-analyzer-1.7</developerConnection>
<url>http://svn.apache.org/viewvc/maven/shared/tags/maven-dependency-analyzer-1.7</url>
<connection>scm:git:https://gitbox.apache.org/repos/asf/maven-dependency-analyzer.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-dependency-analyzer.git</developerConnection>
<url>https://github.com/apache/maven-dependency-analyzer/tree/${project.scm.tag}</url>
<tag>maven-dependency-analyzer-1.10</tag>
</scm>
<issueManagement>
<system>jira</system>
<url>https://issues.apache.org/jira/browse/MSHARED/component/12326428</url>
</issueManagement>
<ciManagement>
<system>Jenkins</system>
<url>https://builds.apache.org/job/maven-box/job/maven-dependency-analyzer/</url>
</ciManagement>
<distributionManagement>
<site>
<id>apache.website</id>
......@@ -55,6 +60,7 @@
<properties>
<mavenVersion>2.0.5</mavenVersion>
<javaVersion>7</javaVersion>
</properties>
<dependencyManagement>
......@@ -70,12 +76,12 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.0.2</version>
<version>6.1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
<scope>test</scope>
</dependency>
<dependency>
......@@ -125,6 +131,24 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-bytecode-version</id>
<configuration>
<rules>
<enforceBytecodeVersion>
<ignoreClasses>
<ignoreClass>module-info</ignoreClass>
</ignoreClasses>
</enforceBytecodeVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
......
......@@ -27,7 +27,7 @@ import java.util.Set;
* Gets the set of classes contained in a library given either as a jar file or an exploded directory.
*
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id: ClassAnalyzer.java 1174427 2011-09-22 22:25:17Z hboutemy $
* @version $Id$
*/
public interface ClassAnalyzer
{
......
......@@ -25,7 +25,7 @@ import java.io.InputStream;
*
*
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id: ClassFileVisitor.java 661727 2008-05-30 14:21:49Z bentmann $
* @version $Id$
*/
public interface ClassFileVisitor
{
......
......@@ -36,7 +36,7 @@ import java.util.jar.JarInputStream;
* Utility to visit classes in a library given either as a jar file or an exploded directory.
*
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id: ClassFileVisitorUtils.java 1589261 2014-04-22 19:34:38Z mfriedenhagen $
* @version $Id$
*/
public final class ClassFileVisitorUtils
{
......@@ -102,7 +102,8 @@ public final class ClassFileVisitorUtils
{
String name = entry.getName();
if ( name.endsWith( ".class" ) )
// ignore files like package-info.class and module-info.class
if ( name.endsWith( ".class" ) && name.indexOf( '-' ) == -1 )
{
visitClass( name, in, visitor );
}
......
......@@ -27,7 +27,7 @@ import java.util.Set;
* Simply collects the set of visited classes.
*
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id: CollectorClassFileVisitor.java 1174427 2011-09-22 22:25:17Z hboutemy $
* @version $Id$
* @see #getClasses()
*/
public class CollectorClassFileVisitor
......
......@@ -30,7 +30,7 @@ import org.codehaus.plexus.component.annotations.Component;
*
*
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id: DefaultClassAnalyzer.java 1635410 2014-10-30 07:03:49Z hboutemy $
* @version $Id$
*/
@Component( role = ClassAnalyzer.class )
public class DefaultClassAnalyzer
......
......@@ -39,7 +39,7 @@ import org.codehaus.plexus.component.annotations.Requirement;
/**
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id: DefaultProjectDependencyAnalyzer.java 1791601 2017-04-16 11:13:17Z michaelo $
* @version $Id$
*/
@Component( role = ProjectDependencyAnalyzer.class )
public class DefaultProjectDependencyAnalyzer
......
......@@ -27,7 +27,7 @@ import java.util.Set;
* Gets the set of classes referenced by a library given either as a jar file or an exploded directory.
*
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id: DependencyAnalyzer.java 1174427 2011-09-22 22:25:17Z hboutemy $
* @version $Id$
*/
public interface DependencyAnalyzer
{
......
......@@ -32,7 +32,7 @@ import org.apache.maven.artifact.Artifact;
* Project dependencies analysis result.
*
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id: ProjectDependencyAnalysis.java 1635410 2014-10-30 07:03:49Z hboutemy $
* @version $Id$
*/
public class ProjectDependencyAnalysis
{
......@@ -63,6 +63,7 @@ public class ProjectDependencyAnalysis
/**
* Used and declared artifacts.
* @return {@link Artifact}
*/
public Set<Artifact> getUsedDeclaredArtifacts()
{
......@@ -71,6 +72,7 @@ public class ProjectDependencyAnalysis
/**
* Used but not declared artifacts.
* @return {@link Artifact}
*/
public Set<Artifact> getUsedUndeclaredArtifacts()
{
......@@ -79,6 +81,7 @@ public class ProjectDependencyAnalysis
/**
* Unused but declared artifacts.
* @return {@link Artifact}
*/
public Set<Artifact> getUnusedDeclaredArtifacts()
{
......
......@@ -30,7 +30,7 @@ import org.apache.maven.project.MavenProject;
* </ul>
*
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id: ProjectDependencyAnalyzer.java 1400616 2012-10-21 10:44:31Z hboutemy $
* @version $Id$
*/
public interface ProjectDependencyAnalyzer
{
......
......@@ -23,7 +23,7 @@ package org.apache.maven.shared.dependency.analyzer;
*
*
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id: ProjectDependencyAnalyzerException.java 661727 2008-05-30 14:21:49Z bentmann $
* @version $Id$
*/
public class ProjectDependencyAnalyzerException
extends Exception
......
......@@ -31,7 +31,7 @@ import org.codehaus.plexus.component.annotations.Component;
* ASMDependencyAnalyzer
*
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id: ASMDependencyAnalyzer.java 1178573 2011-10-03 20:53:48Z hboutemy $
* @version $Id$
*/
@Component( role = DependencyAnalyzer.class )
public class ASMDependencyAnalyzer
......
......@@ -32,6 +32,12 @@ import java.util.Set;
* ASM does not support.
*
* Adapted from http://stackoverflow.com/a/32278587/23691
*
* Constant pool types:
*
* @see <a href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.4">JVM 9 Sepc</a>
* @see <a href="https://docs.oracle.com/javase/specs/jvms/se10/html/jvms-4.html#jvms-4.4">JVM 10 Sepc</a>
*
*/
public class ConstantPoolParser
{
......@@ -66,6 +72,10 @@ public class ConstantPoolParser
public static final byte CONSTANT_INVOKE_DYNAMIC = 18;
public static final byte CONSTANT_MODULE = 19;
public static final byte CONSTANT_PACKAGE = 20;
private static final int OXF0 = 0xf0;
private static final int OXE0 = 0xe0;
......@@ -93,7 +103,7 @@ public class ConstantPoolParser
switch ( tag )
{
default:
throw new RuntimeException( "Unknown constant pool type" );
throw new RuntimeException( "Unknown constant pool type '" + tag + "'" );
case CONSTANT_UTF8:
stringConstants.put( ix, decodeString( buf ) );
continue;
......@@ -131,6 +141,12 @@ public class ConstantPoolParser
buf.getChar();
buf.getChar();
break;
case CONSTANT_MODULE:
buf.getChar();
break;
case CONSTANT_PACKAGE:
buf.getChar();
break;
}
}
Set<String> result = new HashSet<String>();
......
......@@ -37,7 +37,7 @@ public class DefaultAnnotationVisitor
public DefaultAnnotationVisitor( ResultCollector resultCollector )
{
super( Opcodes.ASM5 );
super( Opcodes.ASM6 );
this.resultCollector = resultCollector;
}
......
......@@ -57,7 +57,7 @@ public class DefaultClassVisitor
FieldVisitor fieldVisitor, MethodVisitor methodVisitor,
ResultCollector resultCollector )
{
super( Opcodes.ASM5 );
super( Opcodes.ASM6 );
this.signatureVisitor = signatureVisitor;
this.annotationVisitor = annotationVisitor;
this.fieldVisitor = fieldVisitor;
......
......@@ -39,7 +39,7 @@ public class DefaultFieldVisitor
public DefaultFieldVisitor( AnnotationVisitor annotationVisitor, ResultCollector resultCollector )
{
super( Opcodes.ASM5 );
super( Opcodes.ASM6 );
this.annotationVisitor = annotationVisitor;
this.resultCollector = resultCollector;
}
......
......@@ -24,6 +24,7 @@ import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.TypePath;
import org.objectweb.asm.signature.SignatureReader;
import org.objectweb.asm.signature.SignatureVisitor;
......@@ -47,7 +48,7 @@ public class DefaultMethodVisitor
public DefaultMethodVisitor( AnnotationVisitor annotationVisitor, SignatureVisitor signatureVisitor,
ResultCollector resultCollector )
{
super( Opcodes.ASM5 );
super( Opcodes.ASM6 );
this.annotationVisitor = annotationVisitor;
this.signatureVisitor = signatureVisitor;
this.resultCollector = resultCollector;
......@@ -60,6 +61,13 @@ public class DefaultMethodVisitor
return annotationVisitor;
}
@Override
public AnnotationVisitor visitTypeAnnotation( int typeRef, TypePath typePath, String desc, boolean visible )
{
resultCollector.addDesc( desc );
return annotationVisitor;
}
public AnnotationVisitor visitParameterAnnotation( final int parameter, final String desc, final boolean visible )
{
......
......@@ -36,7 +36,7 @@ public class DefaultSignatureVisitor
public DefaultSignatureVisitor( ResultCollector resultCollector )
{
super( Opcodes.ASM5 );
super( Opcodes.ASM6 );
this.resultCollector = resultCollector;
}
......