johnyannj opened a new issue #1242: Api use inner static class will throw 
javassist.NotFoundException
URL: https://github.com/apache/servicecomb-java-chassis/issues/1242
 
 
   demo:
   ```
   @RestSchema(schemaId="demo")
   class Service
   {
       public static class Model
       {
   
       }
   
       @RequestMapping(path = "/get", method = RequestMethod.GET)
       public Model foo()
       {
           return null;
       }
   }
   ```
   
   it will take error at
   
   org.apache.servicecomb.common.javassist.CtType.<init>(CtType.java:55)
   
   ```
     public CtType(JavaType javaType) {
       if (CtTypeJavaType.class.isInstance(javaType)) {
         CtType ctType = ((CtTypeJavaType) javaType).getType();
         init(ctType.ctClass, ctType.hasGenericTypes, ctType.genericSignature);
         return;
       }
   
       ClassLoader classLoader = javaType.getRawClass().getClassLoader();
       try {
         ClassPool classPool = JavassistUtils.getOrCreateClassPool(classLoader);
         **init(classPool.get(javaType.getRawClass().getCanonicalName()), 
javaType.hasGenericTypes(),
             javaType.getGenericSignature()**
         );
       } catch (NotFoundException e) {
         throw new IllegalStateException(
             String.format("Failed to get CtClass for %s in classloader %s.",
                 javaType.getRawClass().getName(),
                 classLoader),
             e);
       }
   }
   
   ```
   
   javaType.getRawClass().getCanonicalName() is "com.zhaoyanblog.Service.Model"
   the classPool.get will throw javassist.NotFoundException
   the right name is "com.zhaoyanblog.Service$Model"

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to