Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-1163

ClassTransformation Javassist Compile error accessing public field of non-component class

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 5.2.0
    • Fix Version/s: None
    • Component/s: tapestry-core
    • Labels:

      Description

      javassist.compiler.CompileError
      _$get_category() not found in com.xxxx.data.CategoryTreeNode
      Hide uninteresting stack frames Stack trace
      javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:716)
      javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:681)
      javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:156)
      javassist.compiler.ast.CallExpr.accept(CallExpr.java:45)
      javassist.compiler.TypeChecker.atVariableAssign(TypeChecker.java:248)
      javassist.compiler.TypeChecker.atAssignExpr(TypeChecker.java:217)
      javassist.compiler.ast.AssignExpr.accept(AssignExpr.java:38)
      javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:241)
      javassist.compiler.CodeGen.atStmnt(CodeGen.java:329)
      javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
      javassist.compiler.Javac.compileStmnt(Javac.java:568)
      javassist.expr.FieldAccess.replace(FieldAccess.java:209)
      org.apache.tapestry5.internal.services.InternalClassTransformationImpl$8.edit(InternalClassTransformationImpl.java:2141)
      javassist.expr.ExprEditor.loopBody(ExprEditor.java:197)
      javassist.expr.ExprEditor.doit(ExprEditor.java:90)
      javassist.CtClassType.instrument(CtClassType.java:1289)
      org.apache.tapestry5.internal.services.InternalClassTransformationImpl.replaceFieldAccess(InternalClassTransformationImpl.java:2147)
      org.apache.tapestry5.internal.services.InternalClassTransformationImpl.performFieldTransformations(InternalClassTransformationImpl.java:2079)
      org.apache.tapestry5.internal.services.InternalClassTransformationImpl.finish(InternalClassTransformationImpl.java:1811)
      org.apache.tapestry5.internal.services.ComponentClassTransformerImpl.transformComponentClass(ComponentClassTransformerImpl.java:185)
      org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.onLoad(ComponentInstantiatorSourceImpl.java:204)
      javassist.Loader.findClass(Loader.java:340)
      org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl$PackageAwareLoader.findClass(ComponentInstantiatorSourceImpl.java:94)
      javassist.Loader.loadClass(Loader.java:311)
      java.lang.ClassLoader.loadClass(ClassLoader.java:250)
      org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.findClass(ComponentInstantiatorSourceImpl.java:297)
      org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.getInstantiator(ComponentInstantiatorSourceImpl.java:277)
      org.apache.tapestry5.internal.pageload.PageLoaderImpl.createAssembler(PageLoaderImpl.java:193)
      org.apache.tapestry5.internal.pageload.PageLoaderImpl.getAssembler(PageLoaderImpl.java:183)
      org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:157)
      org.apache.tapestry5.internal.services.PagePoolCache.checkout(PagePoolCache.java:210)
      org.apache.tapestry5.internal.services.PagePoolImpl.checkout(PagePoolImpl.java:99)
      org.apache.tapestry5.internal.services.RequestPageCacheImpl.get(RequestPageCacheImpl.java:51)
      org.apache.tapestry5.internal.services.ComponentSourceImpl.getPage(ComponentSourceImpl.java:79)

      I believe this is triggered by this code:

      @Cached(watch = "currentNode")
      public List<CategoryTreeNode> getSubNodesForCurrentNode()

      { if (currentNode.category == null) return Collections.emptyList(); return buildNodesForCategory(currentNode.category); }

      CategoryTreeNode has a public field, category. This seems to be getting confused with the component field also named category.

      Workaround: replace public fields with accessor methods.

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              hlship Howard Lewis Ship

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment