[ https://issues.apache.org/jira/browse/SCB-959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16651032#comment-16651032 ]
ASF GitHub Bot commented on SCB-959: ------------------------------------ weichao666 closed pull request #950: [SCB-959] When parsing inner classes,CtType will throw NotFoundException URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/950 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/CtType.java b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/CtType.java index cb4653d6e..7c13f4dad 100644 --- a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/CtType.java +++ b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/CtType.java @@ -52,7 +52,7 @@ public CtType(JavaType javaType) { ClassLoader classLoader = javaType.getRawClass().getClassLoader(); try { ClassPool classPool = JavassistUtils.getOrCreateClassPool(classLoader); - init(classPool.get(javaType.getRawClass().getCanonicalName()), javaType.hasGenericTypes(), + init(classPool.get(javaType.getRawClass().getName()), javaType.hasGenericTypes(), javaType.getGenericSignature() ); } catch (NotFoundException e) { diff --git a/common/common-javassist/src/test/java/org/apache/servicecomb/common/javassist/TestCtType.java b/common/common-javassist/src/test/java/org/apache/servicecomb/common/javassist/TestCtType.java index 1a6760e39..083b375e5 100644 --- a/common/common-javassist/src/test/java/org/apache/servicecomb/common/javassist/TestCtType.java +++ b/common/common-javassist/src/test/java/org/apache/servicecomb/common/javassist/TestCtType.java @@ -17,7 +17,6 @@ package org.apache.servicecomb.common.javassist; import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.mockito.Mockito; @@ -121,4 +120,20 @@ public void fromJavaType_void() { Assert.assertTrue(voidCtType.getCtClass().isPrimitive()); Assert.assertEquals("void", voidCtType.getCtClass().getName()); } + + class Inner { + Inner() { + } + } + + @Test + public void fromJavaType_innerClass() throws NotFoundException { + Class<?> cls = Inner.class; + JavaType javaType = TypeFactory.defaultInstance().constructType(cls); + ctType = new CtType(javaType); + Assert.assertSame(JavassistUtils.getOrCreateClassPool(cls.getClassLoader()) + .get(cls.getName()), ctType.getCtClass()); + Assert.assertFalse(ctType.hasGenericTypes()); + Assert.assertEquals("Lorg/apache/servicecomb/common/javassist/TestCtType$Inner;", ctType.getGenericSignature()); + } } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > When parsing inner classes,CtType will throw NotFoundException > -------------------------------------------------------------- > > Key: SCB-959 > URL: https://issues.apache.org/jira/browse/SCB-959 > Project: Apache ServiceComb > Issue Type: Bug > Components: Java-Chassis > Reporter: WeiChao > Assignee: WeiChao > Priority: Major > Fix For: java-chassis-1.1.0 > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)