river-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter <j...@zeus.net.au>
Subject Re: svn commit: r1715098 - in /river/jtsk/branches/2.2: ./ qa/ qa/doc/ src/com/sun/jini/tool/classdepend/ src/manifest/
Date Thu, 19 Nov 2015 10:55:39 GMT
Ah yes that's right.  I had been running these tests successfully for a long time, I may still have some saved test results, I think it may have had something to do with a jvm version upgrade around the time I made those interfaces public.

Sent from my Samsung device.
  Include original message
---- Original message ----
From: Greg Trasuk <trasukg@stratuscom.com>
Sent: 19/11/2015 07:56:50 pm
To: dev@river.apache.org
Subject: Re: svn commit: r1715098 - in /river/jtsk/branches/2.2: ./ qa/ qa/doc/ src/com/sun/jini/tool/classdepend/ src/manifest/

Not latent bugs or concurrency related.  The ActivatableExporter requrires exported interfaces to be public.  I’m not sure what the justification is, but it’s a runtime test written into ActivationExporter.  Some of the interfaces that are actually exported in the services are declared package-private (i.e. “default” access).  That’s why I said that the activation tests have probably not actually been running successfully for a while.  But if we’re getting rid of Activation, it doesn’t make much sense to track down all the interfaces and make them public. 

Cheers, 

Greg Trasuk 



> On Nov 19, 2015, at 1:45 AM, Peter <jini@zeus.net.au> wrote: 
>  
> Sounds like you've encountered latent bugs.  I found that too; unrelated code broke.  if you get time I'd be interested in your results of running the qa refactor test suite against the 2.2 branch? 
>  
> Many concurrency / race condition bugs there was in the test suite. 
>  
> Regards, 
>  
> Peter. 
>  
>  
> Sent from my Samsung device. 
>   Include original message 
> ---- Original message ---- 
> From: gtrasuk@apache.org 
> Sent: 19/11/2015 04:11:21 pm 
> To: commits@river.apache.org 
> Subject: svn commit: r1715098 - in /river/jtsk/branches/2.2: ./ qa/ qa/doc/ src/com/sun/jini/tool/classdepend/ src/manifest/ 
>  
> Author: gtrasuk  
> Date: Thu Nov 19 06:11:20 2015  
> New Revision: 1715098  
>  
> URL: http://svn.apache.org/viewvc?rev=1715098&view=rev  
> Log:  
> River 2.2x now builds on JDK 1.8.  Thanks to Shawn Ellis, who contributed a patch for classdep in RIVER-444, which updates classdep to use ASM 5.03.  
>  
> Greg Trasuk modified further to reference ASM5.0.4 which is downloaded using Apache Ivy.  
>  
> Apache Ivy was added to download ASM, JUnit and Velocity automatically from Maven Central.  
>  
> Animal-sniffer was not actually being used in the 2.2.x branch, so has been removed.  
>  
> Note that after this patch, the QA tests will fail on the Activation tests (although they may have been failing for a while, since this patch didn't actually touch any activation code).  It is expected that the activation subsystem and associated tests will be removed shortly.  
>  
> Added:  
>     river/jtsk/branches/2.2/ivy.xml  
> Removed:  
>     river/jtsk/branches/2.2/src/com/sun/jini/tool/classdepend/AbstractVisitor.java  
> Modified:  
>     river/jtsk/branches/2.2/build.xml  
>     river/jtsk/branches/2.2/common.xml  
>     river/jtsk/branches/2.2/qa/build.xml  
>     river/jtsk/branches/2.2/qa/doc/   (props changed)  
>     river/jtsk/branches/2.2/src/com/sun/jini/tool/classdepend/AbstractDependencyVisitorjava  
>     river/jtsk/branches/2.2/src/com/sun/jini/tool/classdepend/ReferencedClasses.java  
>     river/jtsk/branches/2.2/src/manifest/tools.mf  
>  
> Modified: river/jtsk/branches/2.2/build.xml  
> URL: http://svn.apache.org/viewvc/river/jtsk/branches/2.2/buildxml?rev=1715098&r1=1715097&r2=1715098&view=diff  
> ==============================================================================  
> --- river/jtsk/branches/2.2/build.xml (original)  
> +++ river/jtsk/branches/2.2/build.xml Thu Nov 19 06:11:20 2015  
> @@ -27,7 +27,8 @@  
>  <!-- ##                                                                 -->  
>  <!-- ################################################################## -->  
>  <project name="river" basedir="." default="all.build"  
> -        xmlns:artifact="antlib:org.apache.maven.artifact.ant">  
> +        xmlns:artifact="antlib:org.apache.maven.artifact.ant"  
> +        xmlns:ivy="antlib:org.apache.ivy.ant">  
>    
>      <description>Apache River is a project furthering the development  
>          and advancement of Jini technology.</description>  
> @@ -90,20 +91,6 @@  
>          <exclude name="${doc}/release-notes/new.html"/>  
>      </fileset>  
>    
> -    <fileset id="examples.bin.files" dir="${basedir}/examples">  
> -        <include name="**/${lib}/**"/>  
> -        <include name="**/config/**"/>  
> -        <exclude name="**/config/META-INF/"/>  
> -        <include name="**/prebuiltkeys/**"/>  
> -        <include name="**/scripts/*.bat"/>  
> -        <include name="**/${doc}/**"/>  
> -        <include name="**/*.html"/>  
> -    </fileset>  
> -      
> -    <fileset id="examples.bin.exec.files" dir="${basedir}/examples">  
> -        <include name="**/scripts/*.sh"/>  
> -    </fileset>  
> -  
>      <!-- TODO create separate bin distribution for the qa tests? -->  
>      <!--<fileset id="qa.bin.files" dir="${basedir}/qa">  
>          <include name="${lib}/**"/>  
> @@ -120,15 +107,11 @@  
>          <delete file="${bin.zip.bundle}"/>  
>          <zip destfile="${bin.zip.bundle}" roundup="yes">  
>              <zipfileset prefix="${product.name}" refid="river.bin.files" />  
> -            <zipfileset prefix="${product.name}/examples" refid="examples.bin.files" />  
> -            <zipfileset prefix="${product.name}/examples" refid="examples.bin.exec.files" filemode="755"/>  
>              <!--<zipfileset prefix="${product.name}/qa" refid="qa.bin.files" />-->  
>          </zip>  
>          <delete file="${bin.tar.bundle}"/>  
>          <tar destfile="${bin.tar.bundle}" compression="gzip" longfile="gnu">  
>              <tarfileset prefix="${product.name}" refid="river.bin.files" />  
> -            <tarfileset prefix="${product.name}/examples" refid="examples.bin.files" />  
> -            <tarfileset prefix="${product..name}/examples" refid="examples.bin.exec.files" filemode="755"/>  
>              <!--<tarfileset prefix="${product.name}/qa" refid="qa.bin.files" />-->  
>          </tar>  
>      </target>  
> @@ -156,18 +139,6 @@  
>    
>      </fileset>  
>    
> -    <fileset id="examples.srcfiles" dir="${basedir}/examples">  
> -        <include name="**"/>  
> -        <exclude name="**/${lib}/"/>  
> -        <exclude name="**/${build}/"/>  
> -        <exclude name="**/prebuiltkeys/"/>  
> -        <exclude name="**/${doc}/"/>  
> -    </fileset>  
> -  
> -    <fileset id="examples.src.exec.files" dir="${basedir}/examples">  
> -        <include name="**/scripts/*.sh"/>  
> -    </fileset>  
> -  
>      <fileset id="qa.src.files" dir="${basedir}/qa">  
>          <include name="${src}/**"/>  
>          <include name="harness/**"/>  
> @@ -202,18 +173,11 @@  
>          <delete file="${src.zip.bundle}"/>  
>          <zip destfile="${src.zip.bundle}" roundup="yes">  
>              <zipfileset prefix="${product.name}" refid="river.src.files"/>  
> -            <zipfileset prefix="${productname}/examples" refid="examples.src.files"/>  
> -            <zipfileset prefix="${product.name}/examples"  
> -                    refid="examples.src.exec.files" filemode="755"/>  
>              <zipfileset prefix="${productname}/qa" refid="qa.src.files" />  
>          </zip>  
>          <delete file="${src.tarbundle}"/>  
>          <tar destfile="${src.tar.bundle}" compression="gzip" longfile="gnu">  
>              <tarfileset prefix="${product.name}" refid="river.src.files" />  
> -            <tarfileset prefix="${product.name}/examples"  
> -                    refid="examples.src.files" />  
> -            <tarfileset prefix="${product.name}/examples"  
> -                    refid="examples.src.exec.files" filemode="755"/>  
>              <tarfileset prefix="${product.name}/qa" refid="qasrc.files" />  
>          </tar>  
>      </target>  
> @@ -515,10 +479,49 @@  
>          </javac-cmd>  
>      </target>  
>    
> -    <target name="copy-extlibs" >  
> -        <copy todir="lib">  
> -            <fileset refid="asm.jars"/>  
> -        </copy>  
> +    <property name="ivy.install.version" value="2.4.0"/>  
> +    <property name="ivy.jar.dir" value="${build}/lib"/>  
> +    <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>  
> +    <condition property="skip.ivy.download">  
> +        <available file="${ivy.jar.file}"/>  
> +    </condition>  
> +      
> +    <target name="download-ivy" unless="skip.ivy.download">  
> +        <mkdir dir="${ivy.jar.dir}"/>  
> +        <!-- download Ivy from web site so that it can be used even without any special installation -->  
> +        <echo message="installing ivy..."/>  
> +        <get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"  
> +             dest="${ivy.jar.file}" usetimestamp="true"/>  
> +    </target>  
> +      
> +    <!-- =================================   
> +     target: install-ivy           
> +       this target is not necessary if you put ivy.jar in your ant lib directory  
> +       if you already have ivy in your ant lib, you can simply remove this  
> +       target and the dependency the 'go' target has on it  
> +    ================================= -->  
> +    <target name="install-ivy" depends="download-ivy" description="--> install ivy">  
> +        <!-- try to load ivy here from local ivy dir, in case the user has not already dropped  
> +        it into ant's lib dir (note that the latter copy will always take precedence).  
> +        We will not fail as long as local lib dir exists (it may be empty) and  
> +        ivy is in at least one of ant's lib dir or the local lib dir -->  
> +        <path id="ivy.lib.path">  
> +            <fileset dir="${ivy.jar.dir}" includes="*.jar"/>  
> +        </path>  
> +        <taskdef resource="org/apache/ivy/ant/antlib.xml"  
> +                 uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>  
> +    </target>      
> +      
> +  
> +    <target name="copy-extlibs" depends="install-ivy">          
> +        <!-- Let's use Ivy instead... -->  
> +        <ivy:resolve conf="*, tools"/>  
> +        <ivy:retrieve pattern="${lib}/[artifact]-[revision].[ext]"   
> +            conf="tools"/>  
> +        <ivy:retrieve pattern="test/${lib}/[artifact]-[revision].[ext]"   
> +            conf="tests"/>  
> +          
> +  
>      </target>  
>    
>      <target name="install-policy"  
> @@ -551,6 +554,7 @@  
>      <target name="clean-jars"  
>          description="Deletes the lib, lib-dl, and lib-ext directories.">  
>          <delete dir="${lib.dir}" quiet="true" />  
> +        <delete dir="${test.libdir}" quiet="true" />  
>          <delete dir="${lib-dl.dir}"    quiet="true"/>  
>          <delete dir="${lib-ext.dir}" quiet="true"/>  
>      </target>  
> @@ -2159,7 +2163,7 @@  
>                com/sun/jini/tool/envcheck/plugins/resources/*.properties" />  
>          </jar>  
>          <preferredlistgen>  
> -            <arg line="-cp"    />  
> +            <arg line="-cp"/>  
>              <arg path="${build.classes.dir}"/>  
>              <arg line="-jar"/>  
>              <arg path="${lib.dir}/tools.jar"/>  
> @@ -2192,40 +2196,30 @@  
>              description="Build all, including subcomponents">  
>              <!-- Call qa subcomponent build -->  
>          <ant dir="qa" target="build" inheritall="false" />  
> -        <!-- Call examples/hello subcomponent build -->  
> -        <ant dir="examples/hello" target="build" inheritall="false" />  
>      </target>  
>    
>      <target name="all.clean" depends="clean,clean-tests"  
>              description="Clean all, including subcomponents">  
>          <!-- Call qa subcomponent build -->  
>          <ant dir="qa" target="clean" inheritall="false" />  
> -        <!-- Call examples/hello subcomponent build -->  
> -        <ant dir="examples/hello" target="clean" inheritall="false" />  
>      </target>  
>    
>      <target name="all.compile" depends="jars"  
>              description="Compile all, including subcomponents">  
>          <!-- Call qa subcomponent build -->  
>          <ant dir="qa" target="compile" inheritall="false" />  
> -        <!-- Call examples/hello subcomponent build -->  
> -        <ant dir="examples/hello" target="compile" inheritall="false" />  
>      </target>  
>    
>      <target name="all.doc" depends="jars,river-doc"  
>              description="Generate javadoc for all, including subcomponents">  
>          <!-- Call qa subcomponent build -->  
>          <ant dir="qa" target="doc" inheritall="false" />  
> -        <!-- Call examples/hello subcomponent build -->  
> -        <ant dir="examples/hello" target="doc" inheritall="false" />  
>      </target>  
>    
>      <target name="all.jars" depends="jars"  
>              description="Generate JAR files for all, including subcomponents">  
>          <!-- Call qa subcomponent build -->  
>          <ant dir="qa" target="jars" inheritall="false" />  
> -        <!-- Call examples/hello subcomponent build -->  
> -        <ant dir="examples/hello" target="jars" inheritall="false" />  
>      </target>  
>    
>      <!-- TODO: cleanup and find out where exactly to publish to -->  
>  
> Modified: river/jtsk/branches/2.2/common.xml  
> URL: http://svn.apache.org/viewvc/river/jtsk/branches/2.2/common.xml?rev=1715098&r1=1715097&r2=1715098&view=diff  
> ==============================================================================  
> --- river/jtsk/branches/2.2/common.xml (original)  
> +++ river/jtsk/branches/2.2/common.xml Thu Nov 19 06:11:20 2015  
> @@ -125,12 +125,13 @@  
>          <pathelement path="${river.classes.dir}"/>  
>      </path>  
>    
> -    <fileset id="asm.jars" dir="${root}/asm">  
> -        <include name="asm-3.2.jar" />  
> -        <include name="asm-commons-3.2.jar" />  
> +    <fileset id="asm.jars" dir="${root}/lib">  
> +        <include name="asm-5.0.4.jar" />  
> +        <include name="asm-commons-5.0.4jar" />  
> +        <include name="asm-tree-5.0.4.jar"/>  
>      </fileset>  
>    
> -    <fileset id="velocity.jars" dir="${root}/velocity">  
> +    <fileset id="velocity.jars" dir="${root}/lib">  
>          <include name="velocity-1.7.jar" />  
>      </fileset>  
>    
>  
> Added: river/jtsk/branches/22/ivy.xml  
> URL: http://svn.apache.org/viewvc/river/jtsk/branches/2.2/ivy.xml?rev=1715098&view=auto  
> ==============================================================================  
> --- river/jtsk/branches/2.2/ivy.xml (added)  
> +++ river/jtsk/branches/2.2/ivy.xml Thu Nov 19 06:11:20 2015  
> @@ -0,0 +1,40 @@  
> +<?xml version="1.0" encoding="UTF-8"?>  
> +<!--  
> + ! 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.  
> + !-->  
> +   
> +<ivy-module  
> +    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'  
> +    xsi:noNamespaceSchemaLocation='http://ant.apache.org/ivy/schemas/ivy.xsd' version="2.0">  
> +    <info organisation="org.apache.river"  
> +          module="river"/>  
> +          <configurations>  
> +              <conf name="tools"/>  
> +              <conf name="tests"/>  
> +              <conf name="qa"/>  
> +          </configurations>  
> +    <dependencies>  
> +        <dependency org="org.ow2.asm" name="asm" rev="5.0.4" conf="tools->default"/>  
> +        <dependency org="org.ow2.asm" name="asm-commons" rev="5.0.4" conf="tools->default"/>  
> +        <dependency org="org.ow2.asm" name="asm-tree" rev="5.0.4" conf="tools->default"/>  
> +        <dependency org="org.apache.velocity" name="velocity" rev="1.7" conf="tools->default"/>          
> +        <dependency org="junit" name="junit" rev="4.11" conf="tests->default"/>  
> +        <dependency org="orgmockito" name="mockito-all" rev="1.9.5" conf="tests->default"/>  
> +  
> +    </dependencies>     
> +  
> +</ivy-module>  
>  
> Modified: river/jtsk/branches/2.2/qa/build.xml  
> URL: http://svn.apache.org/viewvc/river/jtsk/branches/2.2/qa/build.xml?rev=1715098&r1=1715097&r2=1715098&view=diff  
> ==============================================================================  
> --- river/jtsk/branches/2.2/qa/build.xml (original)  
> +++ river/jtsk/branches/2.2/qa/build.xml Thu Nov 19 06:11:20 2015  
> @@ -180,7 +180,7 @@  
>    
>      <target name="compile" depends="copy-resources" description="Build classes">  
>          <property name="qa.source" value="5" />  
> -        <property name="qa.target" value="jsr14" />  
> +        <property name="qa.target" value="5" />  
>          <javac-cmd source="${qa.source}" target="${qa.target}" source.dir="${src.dir}" dest.dir="${build.classes.dir}">  
>              <classpath refid="river.jars"/>  
>              <compilerarg value="-J-Xmx128m" />  
>  
> Propchange: river/jtsk/branches/2.2/qa/doc/  
> ------------------------------------------------------------------------------  
> --- svn:ignore (original)  
> +++ svn:ignore Thu Nov 19 06:11:20 2015  
> @@ -1,2 +1,3 @@  
>  api  
>  .~lock.qaarch.sdw#  
> +.~lock.qaarch.odt#  
>  
> Modified: river/jtsk/branches/2.2/src/com/sun/jini/tool/classdepend/AbstractDependencyVisitor.java  
> URL: http://svn.apache.org/viewvc/river/jtsk/branches/2.2/src/com/sun/jini/tool/classdepend/AbstractDependencyVisitor.java?rev=1715098&r1=1715097&r2=1715098&view=diff  
> ==============================================================================  
> --- river/jtsk/branches/2.2/src/com/sun/jini/tool/classdepend/AbstractDependencyVisitor.java (original)  
> +++ river/jtsk/branches/2.2/src/com/sun/jini/tool/classdepend/AbstractDependencyVisitor.java Thu Nov 19 06:11:20 2015  
> @@ -2,7 +2,7 @@ package com.sun.jini.tool.classdepend;  
>    
>  /***  
>   * ASM examples: examples showing how ASM can be used  
> - * Copyright (c) 2000-2005 INRIA, France Telecom  
> + * Copyright (c) 2000-2011 INRIA, France Telecom  
>   * All rights reserved.  
>   *  
>   * Redistribution and use in source and binary forms, with or without  
> @@ -30,232 +30,388 @@ package com.sun.jini.tool.classdepend;  
>   * THE POSSIBILITY OF SUCH DAMAGE.  
>   */  
>    
> -import java.util.regex.Matcher;  
> -import java.util.regex.Pattern;  
> +import java.util.HashMap;  
> +import java.util.HashSet;  
> +import java.util.Map;  
> +import java.util.Set;  
> +  
>  import org.objectweb.asm.AnnotationVisitor;  
>  import org.objectweb.asm.ClassVisitor;  
>  import org.objectweb.asm.FieldVisitor;  
> +import org.objectweb.asm.Handle;  
>  import org.objectweb.asm.Label;  
>  import org.objectwebasm.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;  
>    
>  /**  
> - *   
> - *   
> + * DependencyVisitor  
> + *  
> + * @author Eugene Kuleshov  
>   */  
> -abstract class AbstractDependencyVisitor extends AbstractVisitor {  
> +public abstract class AbstractDependencyVisitor extends ClassVisitor {  
> +    Set<String> packages = new HashSet<String>();  
>    
> -    AbstractDependencyVisitor() { }  
> +    Map<String, Map<String, Integer>> groups = new HashMap<String, Map<String, Integer>>();  
>    
> -    abstract protected void addName(String name);  
> +    Map<String, Integer> current;  
>    
> -    /* -- ClassVisitor -- */  
> +    public Map<String, Map<String, Integer>> getGlobals() {  
> +        return groups;  
> +    }  
>    
> -    public void visit(int version, int access, String name, String signature,  
> -              String superName, String[] interfaces)  
> -    {  
> -    if (signature == null) {  
> -        addNameInternal(superName);  
> -        addNames(interfaces);  
> -    } else {  
> -        addSignature(signature);  
> -    }  
> +    public Set<String> getPackages() {  
> +        return packages;  
>      }  
> -      
> -    public AnnotationVisitor visitAnnotation(String desc, boolean visible) {  
> -    addDesc(desc);  
> -    return this;  
> +  
> +    public AbstractDependencyVisitor() {  
> +        super(Opcodes.ASM5);  
>      }  
>    
> -    public FieldVisitor visitField(int access, String name, String desc,  
> -                   String signature, Object value)  
> -    {  
> -    if (signature == null) {  
> -        addDesc(desc);  
> -    } else {  
> -        addTypeSignature(signature);  
> -    }  
> -    if (value instanceof Type) {  
> -            addType((Type) value);  
> +    abstract protected void addName(String name);  
> +  
> +    // ClassVisitor  
> +  
> +    @Override  
> +    public void visit(final int version, final int access, final String name,  
> +            final String signature, final String superName,  
> +            final String[] interfaces) {  
> +        String p = getGroupKey(name);  
> +        current = groups.get(p);  
> +        if (current == null) {  
> +            current = new HashMap<String, Integer>();  
> +            groups.put(p, current);  
>          }  
> -    return this;  
> -    }  
> -      
> -    public MethodVisitor visitMethod(int access, String name, String desc,  
> -                     String signature, String[] exceptions)  
> -    {  
> +  
>          if (signature == null) {  
> -            addMethodDesc(desc);  
> +            if (superName != null) {  
> +                addInternalName(superName);  
> +            }  
> +            addInternalNames(interfaces);  
>          } else {  
>              addSignature(signature);  
>          }  
> -        addNames(exceptions);  
> -        return this;  
>      }  
>    
> -    public void visitInnerClass(String name, String outerName,  
> -                String innerName, int access)  
> +    @Override  
> +    public void visitInnerClass(String name, String outerName, String innerName,  
> +                int access)  
>      {  
> -    /* XXX: Do we need to consider inner classes?  
> -         * Yes the old ClassDep tool includes them */  
> -        addNameInternal(outerName);  
> -    addNameInternal(name);  
> +    addInternalName(outerName);  
> +    addInternalName(name);  
>      }  
>    
> -    /* -- MethodVisitor -- */  
> +    @Override  
> +    public AnnotationVisitor visitAnnotation(final String desc,  
> +            final boolean visible) {  
> +        addDesc(desc);  
> +        return new AnnotationDependencyVisitor();  
> +    }  
>    
> -    public AnnotationVisitor visitParameterAnnotation(int parameter,  
> -                              String desc,  
> -                              boolean visible)  
> -    {  
> +    @Override  
> +    public AnnotationVisitor visitTypeAnnotation(final int typeRef,  
> +            final TypePath typePath, final String desc, final boolean visible) {  
>          addDesc(desc);  
> -        return this;  
> +        return new AnnotationDependencyVisitor();  
>      }  
>    
> -    public void visitTypeInsn(int opcode, String desc) {  
> -        if (desc.charAt(0) == '[') {  
> +    @Override  
> +    public FieldVisitor visitField(final int access, final String name,  
> +            final String desc, final String signature, final Object value) {  
> +        if (signature == null) {  
>              addDesc(desc);  
>          } else {  
> -            addNameInternal(desc);  
> -    }  
> +            addTypeSignature(signature);  
> +        }  
> +        if (value instanceof Type) {  
> +            addType((Type) value);  
> +        }  
> +        return new FieldDependencyVisitor();  
>      }  
>    
> -    public void visitFieldInsn(int opcode, String owner, String name,  
> -                   String desc)  
> -    {  
> -        addNameInternal(owner);  
> -        addDesc(desc);  
> -    }  
> -      
> -    String pattern = "^\\[{0,2}L{0,1}(\\w+[/.]{1}[\\w$\\d/.]+);{0,1}$";  
> -    Pattern arrayOfObjects = Pattern.compile(pattern);  
> -    public void visitMethodInsn(int opcode, String owner, String name,  
> -                String desc)  
> -    {  
> -        /* This filters out Generic's and primitive owners.  
> -         *  
> -         * Also when the owner is an array, containing Objects and  
> -         * the method name is clone(), (I think it's got something to do  
> -         * with cloning array's, this must be a new java 5 language feature  
> -         * I tested 1.4 code without this ever occurring)        
> -         * we can't get the Object's type  
> -         * using Type.getType(owner) due to the nature of   
> -         * the ASM Core API requiring bytecode be read sequentially.  
> -         * This only occurs with clone() which returns java.lang.Object  
> -         */  
> -        Matcher match = arrayOfObjects.matcher(owner);  
> -        while (match.find()){  
> -            String object = match.group(1);  
> -            addNameInternal(object);  
> -        }   
> -        addMethodDesc(desc);  
> +    @Override  
> +    public MethodVisitor visitMethod(final int access, final String name,  
> +            final String desc, final String signature, final String[] exceptions) {  
> +        if (signature == null) {  
> +            addMethodDesc(desc);  
> +        } else {  
> +            addSignature(signature);  
> +        }  
> +        addInternalNames(exceptions);  
> +        return new MethodDependencyVisitor();  
>      }  
>    
> -    public void visitLdcInsn(Object cst) {  
> -        if (cst instanceof Type) {  
> -            addType((Type) cst);  
> -    }  
> -    }  
> +    class AnnotationDependencyVisitor extends AnnotationVisitor {  
>    
> -    public void visitMultiANewArrayInsn(String desc, int dims) {  
> -        addDesc(desc);  
> -    }  
> +        public AnnotationDependencyVisitor() {  
> +            super(Opcodes.ASM5);  
> +        }  
>    
> -    public void visitLocalVariable(String name, String desc, String signature,  
> -                   Label start, Label end, int index)  
> -    {  
> -    if (signature != null) {  
> -        addTypeSignature(signature);  
> -    }  
> -    }  
> +        @Override  
> +        public void visit(final String name, final Object value) {  
> +            if (value instanceof Type) {  
> +                addType((Type) value);  
> +            }  
> +        }  
>    
> -    public void visitTryCatchBlock(Label start, Label end, Label handler,  
> -                   String type)  
> -    {  
> -        addNameInternal(type);  
> -    }  
> +        @Override  
> +        public void visitEnum(final String name, final String desc,  
> +                final String value) {  
> +            addDesc(desc);  
> +        }  
>    
> -    /* -- AnnotationVisitor -- */  
> +        @Override  
> +        public AnnotationVisitor visitAnnotation(final String name,  
> +                final String desc) {  
> +            addDesc(desc);  
> +            return this;  
> +        }  
>    
> -    public void visit(String name, Object value) {  
> -        if (value instanceof Type) {  
> -            addType((Type) value);  
> -    }  
> +        @Override  
> +        public AnnotationVisitor visitArray(final String name) {  
> +            return this;  
> +        }  
>      }  
>    
> -    public void visitEnum(String name, String desc, String value) {  
> -        addDesc(desc);  
> -    }  
> +    class FieldDependencyVisitor extends FieldVisitor {  
>    
> -    public AnnotationVisitor visitAnnotation(String name, String desc) {  
> -        addDesc(desc);  
> -        return this;  
> +        public FieldDependencyVisitor() {  
> +            super(Opcodes.ASM5);  
> +        }  
> +  
> +        @Override  
> +        public AnnotationVisitor visitAnnotation(String desc, boolean visible) {  
> +            addDesc(desc);  
> +            return new AnnotationDependencyVisitor();  
> +        }  
> +  
> +        @Override  
> +        public AnnotationVisitor visitTypeAnnotation(final int typeRef,  
> +                final TypePath typePath, final String desc,  
> +                final boolean visible) {  
> +            addDesc(desc);  
> +            return new AnnotationDependencyVisitor();  
> +        }  
>      }  
>    
> -    /* -- SignatureVisitor -- */  
> +    class MethodDependencyVisitor extends MethodVisitor {  
>    
> -    public void visitTypeVariable(String name) {  
> -        /* XXX: Need to do something? */  
> -        //System.out.println(name);  
> +        public MethodDependencyVisitor() {  
> +            super(Opcodes.ASM5);  
> +        }  
> +  
> +        @Override  
> +        public AnnotationVisitor visitAnnotationDefault() {  
> +            return new AnnotationDependencyVisitor();  
> +        }  
> +  
> +        @Override  
> +        public AnnotationVisitor visitAnnotation(final String desc,  
> +                final boolean visible) {  
> +            addDesc(desc);  
> +            return new AnnotationDependencyVisitor();  
> +        }  
> +  
> +        @Override  
> +        public AnnotationVisitor visitTypeAnnotation(final int typeRef,  
> +                final TypePath typePath, final String desc,  
> +                final boolean visible) {  
> +            addDesc(desc);  
> +            return new AnnotationDependencyVisitor();  
> +        }  
> +  
> +        @Override  
> +        public AnnotationVisitor visitParameterAnnotation(final int parameter,  
> +                final String desc, final boolean visible) {  
> +            addDesc(desc);  
> +            return new AnnotationDependencyVisitor();  
> +        }  
> +  
> +        @Override  
> +        public void visitTypeInsn(final int opcode, final String type) {  
> +            addType(Type.getObjectType(type));  
> +        }  
> +  
> +        @Override  
> +        public void visitFieldInsn(final int opcode, final String owner,  
> +                final String name, final String desc) {  
> +            addInternalName(owner);  
> +            addDesc(desc);  
> +        }  
> +  
> +        @Override  
> +        public void visitMethodInsn(final int opcode, final String owner,  
> +                final String name, final String desc, final boolean itf) {  
> +            addInternalName(owner);  
> +            addMethodDesc(desc);  
> +        }  
> +  
> +        @Override  
> +        public void visitInvokeDynamicInsn(String name, String desc,  
> +                Handle bsm, Object... bsmArgs) {  
> +            addMethodDesc(desc);  
> +            addConstant(bsm);  
> +            for (int i = 0; i < bsmArgs.length; i++) {  
> +                addConstant(bsmArgs[i]);  
> +            }  
> +        }  
> +  
> +        @Override  
> +        public void visitLdcInsn(final Object cst) {  
> +            addConstant(cst);  
> +        }  
> +  
> +        @Override  
> +        public void visitMultiANewArrayInsn(final String desc, final int dims) {  
> +            addDesc(desc);  
> +        }  
> +  
> +        @Override  
> +        public AnnotationVisitor visitInsnAnnotation(int typeRef,  
> +                TypePath typePath, String desc, boolean visible) {  
> +            addDesc(desc);  
> +            return new AnnotationDependencyVisitor();  
> +        }  
> +  
> +        @Override  
> +        public void visitLocalVariable(final String name, final String desc,  
> +                final String signature, final Label start, final Label end,  
> +                final int index) {  
> +            addTypeSignature(signature);  
> +        }  
> +  
> +        @Override  
> +        public AnnotationVisitor visitLocalVariableAnnotation(int typeRef,  
> +                TypePath typePath, Label[] start, Label[] end, int[] index,  
> +                String desc, boolean visible) {  
> +            addDesc(desc);  
> +            return new AnnotationDependencyVisitor();  
> +        }  
> +  
> +        @Override  
> +        public void visitTryCatchBlock(final Label start, final Label end,  
> +                final Label handler, final String type) {  
> +            if (type != null) {  
> +                addInternalName(type);  
> +            }  
> +        }  
> +  
> +        @Override  
> +        public AnnotationVisitor visitTryCatchAnnotation(int typeRef,  
> +                TypePath typePath, String desc, boolean visible) {  
> +            addDesc(desc);  
> +            return new AnnotationDependencyVisitor();  
> +        }  
>      }  
>    
> -    public void visitClassType(String name) {  
> -        addNameInternal(name);  
> +    class SignatureDependencyVisitor extends SignatureVisitor {  
> +  
> +        String signatureClassName;  
> +  
> +        public SignatureDependencyVisitor() {  
> +            super(Opcodes.ASM5);  
> +        }  
> +  
> +        @Override  
> +        public void visitClassType(final String name) {  
> +            signatureClassName = name;  
> +            addInternalName(name);  
> +        }  
> +  
> +        @Override  
> +        public void visitInnerClassType(final String name) {  
> +            signatureClassName = signatureClassName + "$" + name;  
> +            addInternalName(signatureClassName);  
> +        }  
>      }  
>    
> -    public void visitInnerClassType(String name) {  
> -        // This is not a fully qualified class name, ignore.  
> +    // ---------------------------------------------  
> +  
> +    private String getGroupKey(String name) {  
> +        int n = name.lastIndexOf('/');  
> +        if (n > -1) {  
> +            name = name.substring(0, n);  
> +        }  
> +        packages.add(name);  
> +        return name;  
>      }  
>    
> -    /* -- Utilities -- */  
> +    /*  
> +    private void addName(final String name) {  
> +        if (name == null) {  
> +            return;  
> +        }  
> +        String p = getGroupKey(name);  
> +        if (current.containsKey(p)) {  
> +            current.put(p, current.get(p) + 1);  
> +        } else {  
> +            current.put(p, 1);  
> +        }  
> +    }  
> +    */  
>    
> -    private void addNameInternal(String name) {  
> -        if (name != null) {  
> -        addName(name.replace('/', '.'));  
> +    void addInternalName(final String name) {  
> +    if (name != null) {  
> +        addType(Type.getObjectType(name));  
>      }  
>      }  
>    
> -    private void addNames(String[] names) {  
> -    if (names != null) {  
> -            int l = names.length;  
> -        for (int i = 0; i < l; i++) {  
> -                String name = names[i];  
> -        addNameInternal(name);  
> -        }  
> -    }  
> +    private void addInternalNames(final String[] names) {  
> +        for (int i = 0; names != null && i < nameslength; i++) {  
> +            addInternalName(names[i]);  
> +        }  
>      }  
>    
> -    private void addDesc(String desc) {  
> +    void addDesc(final String desc) {  
>          addType(Type.getType(desc));  
>      }  
>    
> -    private void addMethodDesc(String desc) {  
> +    void addMethodDesc(final String desc) {  
>          addType(Type.getReturnType(desc));  
> -        Type [] type = Type.getArgumentTypes(desc);  
> -        int l = type.length;  
> -    for (int i = 0; i < l; i++) {              
> -            addType(type[i]);  
> -    }  
> +        Type[] types = Type.getArgumentTypes(desc);  
> +        for (int i = 0; i < types.length; i++) {  
> +            addType(types[i]);  
> +        }  
>      }  
>    
> -    private void addType(Type t) {  
> +    void addType(final Type t) {  
>          switch (t.getSort()) {  
> -            case Type.ARRAY:  
> -                addType(t.getElementType());  
> -                break;  
> -            case Type.OBJECT:  
> -                addNameInternal(t.getClassName());  
> -                break;  
> +        case Type.ARRAY:  
> +            addType(tgetElementType());  
> +            break;  
> +        case Type.OBJECT:  
> +            addName(t.getInternalName());  
> +            break;  
> +        case Type.METHOD:  
> +            addMethodDesc(t.getDescriptor());  
> +            break;  
> +        }  
> +    }  
> +  
> +    private void addSignature(final String signature) {  
> +        if (signature != null) {  
> +            new SignatureReader(signature)  
> +                    .accept(new SignatureDependencyVisitor());  
>          }  
>      }  
>    
> -    private void addSignature(String signature) {  
> -    new SignatureReader(signature).accept(this);  
> +    void addTypeSignature(final String signature) {  
> +        if (signature != null) {  
> +            new SignatureReader(signature)  
> +                    .acceptType(new SignatureDependencyVisitor());  
> +        }  
>      }  
>    
> -    private void addTypeSignature(String signature) {  
> -    new SignatureReader(signature).acceptType(this);  
> +    void addConstant(final Object cst) {  
> +        if (cst instanceof Type) {  
> +            addType((Type) cst);  
> +        } else if (cst instanceof Handle) {  
> +            Handle h = (Handle) cst;  
> +            addInternalName(h.getOwner());  
> +            addMethodDesc(h.getDesc());  
> +        }  
>      }  
>  }  
>  
> Modified: river/jtsk/branches/2.2/src/com/sun/jini/tool/classdepend/ReferencedClasses.java  
> URL: http://svn.apacheorg/viewvc/river/jtsk/branches/2.2/src/com/sun/jini/tool/classdepend/ReferencedClasses.java?rev=1715098&r1=1715097&r2=1715098&view=diff  
> ==============================================================================  
> --- river/jtsk/branches/2.2/src/com/sun/jini/tool/classdepend/ReferencedClasses.java (original)  
> +++ river/jtsk/branches/2.2/src/com/sun/jini/tool/classdepend/ReferencedClasses.java Thu Nov 19 06:11:20 2015  
> @@ -21,7 +21,11 @@ import java.io.IOException;  
>  import java.io.InputStream;  
>  import java.util.HashSet;  
>  import javautil.Set;  
> +  
> +import org.objectweb.asmAttribute;  
>  import orgobjectweb.asm.ClassReader;  
> +import org.objectweb.asm.ClassVisitor;  
> +import org.objectweb.asm.Opcodes;  
>    
>  /**  
>   * A utility class for computing the classes referred to by another class.  
> @@ -56,7 +60,8 @@ public class ReferencedClasses {  
>      new ClassReader(in).accept(  
>          new AbstractDependencyVisitor() {  
>          protected void addName(String name) {  
> -            dependencies.add(name);  
> +            String className = name.replace('/', '.');  
> +            dependencies.add(className);  
>          }  
>          },  
>          ClassReader.SKIP_DEBUG);  
>  
> Modified: river/jtsk/branches/2.2/src/manifest/tools.mf  
> URL: http://svn.apache.org/viewvc/river/jtsk/branches/2.2/src/manifest/tools.mf?rev=1715098&r1=1715097&r2=1715098&view=diff  
> ==============================================================================  
> --- river/jtsk/branches/2.2/src/manifest/tools.mf (original)  
> +++ river/jtsk/branches/2.2/src/manifest/tools.mf Thu Nov 19 06:11:20 2015  
> @@ -1,3 +1,3 @@  
>  Manifest-Version: 1.0  
>  Main-Class: com.sun.jini..tool.ClassServer  
> -Class-Path: jsk-platform.jar jsk-lib.jar asm-3.2.jar asm-commons-3.2.jar  
> +Class-Path: jsk-platform.jar jsk-lib.jar asm-5.0.4.jar asm-commons-5.0.4.jar  
>  
>  
>  




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message