OSDN Git Service

merge from branch (for asm 3.1)
authortama3 <tama3@acee48c3-7b26-0410-bdac-b3d0e5314bbc>
Wed, 10 Dec 2008 06:18:11 +0000 (06:18 +0000)
committertama3 <tama3@acee48c3-7b26-0410-bdac-b3d0e5314bbc>
Wed, 10 Dec 2008 06:18:11 +0000 (06:18 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/stigmata/digger/trunk@350 acee48c3-7b26-0410-bdac-b3d0e5314bbc

pom.xml
src/main/java/jp/sourceforge/stigmata/digger/ClasspathContext.java
src/main/java/jp/sourceforge/stigmata/digger/DefaultClassFileArchive.java
src/site/apt/download.apt
src/site/resources/images/logos/digger_logo.psd
src/test/java/jp/sourceforge/stigmata/digger/ClassFileEntryTest.java
src/test/java/jp/sourceforge/stigmata/digger/ClasspathContextTest.java

diff --git a/pom.xml b/pom.xml
index 00add12..8e96794 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -1,10 +1,12 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+<project xmlns="http://maven.apache.org/POM/4.0.0"\r
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
 \r
   <modelVersion>4.0.0</modelVersion>\r
   <groupId>jp.sourceforge.stigmata</groupId>\r
   <artifactId>digger</artifactId>\r
   <packaging>jar</packaging>\r
-  <version>1.0.1-SNAPSHOT</version>\r
+  <version>1.1.0-SNAPSHOT</version>\r
   <name>digger</name>\r
   <description>Dig up class files</description>\r
   <url>http://stigmata.sourceforge.jp/digger/</url>\r
@@ -43,7 +45,7 @@
     <dependency>\r
       <groupId>asm</groupId>\r
       <artifactId>asm-all</artifactId>\r
-      <version>2.2.3</version>\r
+      <version>3.1</version>\r
       <scope>compile</scope>\r
     </dependency>\r
     <dependency>\r
       </plugin>\r
     </plugins>\r
   </reporting>\r
-</project>
\ No newline at end of file
+</project>\r
index d8a29ed..56394d7 100644 (file)
@@ -178,7 +178,7 @@ public class ClasspathContext implements Iterable<URL>{
                      parentClassLoader = getClass().getClassLoader();
                 }
                 else{
-                    parentClassLoader = ClassLoader.getSystemClassLoader();   
+                    parentClassLoader = null;
                 }
             }
             loader = new WarClassLoader(list.toArray(new URL[list.size()]), parentClassLoader);
index 79fa018..0655564 100644 (file)
@@ -84,7 +84,7 @@ public class DefaultClassFileArchive implements ClassFileArchive{
             in = new FileInputStream(file);
             ClassReader reader = new ClassReader(in);
             ClassNameExtractVisitor visitor = new ClassNameExtractVisitor();
-            reader.accept(visitor, true);
+            reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
 
             this.className = visitor.getClassName();
         } catch (FileNotFoundException ex) {
index 6fdd4cb..38c08ad 100644 (file)
@@ -45,10 +45,10 @@ permissions and limitations under the License.
  We can see digger-x.x.x-bin.jar, and digger-x.x.x-src.jar.\r
  Both packages mean as followings.\r
 \r
- [digger-x.x.x-bin.jar] binary distribution package, contains class\r
+ [digger-x.x.x-bin.zip/tar.gz/tar.bz2] binary distribution package, contains class\r
    files and resource files.\r
 \r
- [digger-x.x.x-src.jar] source distribution package, contains\r
+ [digger-x.x.x-src.zip/tar.gz/tar.bz2] source distribution package, contains\r
  pom.xml, source files, resource files and documents.\r
  \r
 *Binary download by maven2 \r
@@ -73,9 +73,9 @@ Next, add <<<dependency>>> tag entry to <<<dependencies>>> tag in `pom.xml.'
   <dependencies>\r
       :\r
     <dependency>\r
-      <groupId>jp.sourceforge</groupId>\r
-      <artifactId>stigmata</artifactId>\r
-      <version>1.2.0</version>\r
+      <groupId>jp.sourceforge.stigmata</groupId>\r
+      <artifactId>digger</artifactId>\r
+      <version>1.0.0</version>\r
     </dependency>\r
       :\r
   </dependencies>\r
@@ -90,12 +90,12 @@ Next, add <<<dependency>>> tag entry to <<<dependencies>>> tag in `pom.xml.'
  The source can be checked out anonymously from Subversion.\r
 \r
 ----\r
-$ svn checkout http://svn.sourceforge.jp/svnroot/stigmata/trunk/ stigmata\r
+$ svn checkout http://svn.sourceforge.jp/svnroot/stigmata/digger/trunk digger\r
 ----\r
 \r
 **Web access\r
 \r
  We can browse the source code from following link.\r
 \r
- {{http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi/?root=stigmata}}\r
+ {{http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi/digger/?root=stigmata}}\r
 \r
index 9fb1ea7..dbf9abc 100644 (file)
Binary files a/src/site/resources/images/logos/digger_logo.psd and b/src/site/resources/images/logos/digger_logo.psd differ
index d96dcd3..7c563e8 100644 (file)
@@ -35,5 +35,6 @@ public class ClassFileEntryTest{
         File file = new File("target/classes/jp/sourceforge/stigmata/digger/ClasspathContext.class");
         Assert.assertEquals("jp.sourceforge.stigmata.digger.ClasspathContext", entry.getClassName());
         Assert.assertEquals(file.toURI().toURL(), entry.getLocation());
+        Assert.assertNotNull(entry.openStream());
     }
 }
index 110d469..4fa3e05 100644 (file)
@@ -5,6 +5,7 @@ package jp.sourceforge.stigmata.digger;
  */
 
 import java.io.File;
+import java.net.URL;
 
 import org.junit.Assert;
 import org.junit.Before;
@@ -26,6 +27,8 @@ public class ClasspathContextTest{
 
     @Test
     public void testBasic() throws ClassNotFoundException{
+        Assert.assertEquals(0, context.getClasspathSize());
+
         Class<?> classFileEntryClass = context.findClass("jp.sourceforge.stigmata.digger.ClassFileEntry");
         Class<?> classpathContextClass = context.findClass("jp.sourceforge.stigmata.digger.ClasspathContext");
 
@@ -35,6 +38,47 @@ public class ClasspathContextTest{
         Assert.assertNotNull(context.findEntry("jp.sourceforge.stigmata.digger.ClasspathContext"));
     }
 
+    @Test
+    public void testBasic2() throws Exception{
+        context.addClasspath(new File("target/classes").toURI().toURL());
+        Assert.assertEquals(1, context.getClasspathSize());
+        Assert.assertEquals(new File("target/classes").toURI().toURL(), context.getClasspathList()[0]);
+
+        context.clear();
+        Assert.assertEquals(0, context.getClasspathSize());
+    }
+
+    @Test
+    public void testParent() throws Exception{
+        ClasspathContext subContext = new ClasspathContext(context);
+        context.addClasspath(new File("target/classes").toURI().toURL());
+        subContext.addClasspath(new File("target/asm-all-3.1.jar").toURI().toURL());
+
+        Assert.assertEquals(1, context.getClasspathSize());
+        Assert.assertEquals(2, subContext.getClasspathSize());
+
+        URL[] url = subContext.getClasspathList();
+        Assert.assertEquals(new File("target/classes").toURI().toURL(), url[0]);
+        Assert.assertEquals(new File("target/asm-all-3.1.jar").toURI().toURL(), url[1]);
+
+        subContext.clear();
+        Assert.assertEquals(1, subContext.getClasspathSize());
+
+        subContext.clearAll();
+        Assert.assertEquals(0, subContext.getClasspathSize());
+    }
+
+    @Test
+    public void testParent2() throws Exception{
+        ClasspathContext subContext = new ClasspathContext(context);
+        context.addClasspath(new File("target/classes").toURI().toURL());
+        subContext.addClasspath(new File("target/asm-all-3.1.jar").toURI().toURL());
+
+        Assert.assertTrue(context.isIncludeSystemClasses());
+        subContext.setIncludeSystemClasses(false);
+        Assert.assertFalse(context.isIncludeSystemClasses());
+    }
+
     @Test(expected=ClassNotFoundException.class)
     public void testNotExistedClass() throws Exception{
         context.findClass("not.exists.ClassName");
@@ -77,7 +121,7 @@ public class ClasspathContextTest{
     @Test
     public void testFindEntryNotSearchSystemClasspath4() throws Exception{
         context.addClasspath(new File("target/classes").toURI().toURL());
-        context.addClasspath(new File("target/asm-all-2.2.3.jar").toURI().toURL());
+        context.addClasspath(new File("target/asm-all-3.1.jar").toURI().toURL());
         context.setIncludeSystemClasses(false);
 
         Assert.assertTrue(context.hasEntry("java.lang.Object"));
@@ -115,7 +159,7 @@ public class ClasspathContextTest{
     @Test
     public void testNotSearchSystemClasspath4() throws Exception{
         context.addClasspath(new File("target/classes").toURI().toURL());
-        context.addClasspath(new File("target/asm-all-2.2.3.jar").toURI().toURL());
+        context.addClasspath(new File("target/asm-all-3.1.jar").toURI().toURL());
         context.setIncludeSystemClasses(false);
         Assert.assertNotNull(context.findClass("java.lang.Object"));
         Assert.assertNotNull(context.findClass("jp.sourceforge.stigmata.digger.ClasspathContext"));
@@ -170,7 +214,7 @@ public class ClasspathContextTest{
     @Test
     public void testSubContextNotSearchSystemClasspath4() throws Exception{
         context.addClasspath(new File("target/classes").toURI().toURL());
-        context.addClasspath(new File("target/asm-all-2.2.3.jar").toURI().toURL());
+        context.addClasspath(new File("target/asm-all-3.1.jar").toURI().toURL());
         context.setIncludeSystemClasses(false);
 
         ClasspathContext subContext = new ClasspathContext(context);