Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6500594

DeclaredType.getActualTypeArguments() returns different values based on the javac debug option

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P1 P1
    • 6
    • 2.0
    • tools
    • None
    • sparc
    • solaris_9

      Sample testcase attached.
      Because of this behavior, WsGen is generating incorrect classes when the WebServices it compiles uses java.xml.ws.Holder<T> as WebParam, and many TCK tests are failing.

      In the testcase, for
      public void testHolder(Holder<String> param) { }

      public void visitMethodDeclaration(MethodDeclaration method) {
                      System.out.println(method.getSimpleName());
                      for (ParameterDeclaration param : method.getParameters()) {
                          TypeMirror type = param.getType();
                          System.out.println(type);
                          if (type instanceof DeclaredType) {
                              Collection<TypeMirror> argTypes = ((DeclaredType) type).getActualTypeArguments();
                              System.out.println(argTypes.size());
                              if (argTypes.size() == 1) {
                                  TypeMirror mirror = argTypes.iterator().next();
                                  System.out.println("argsTypes.iterator().next(): " + mirror);
                              }
                          }
                      }
                  }

      argTypes.size is 0 when the sources are compiled with debug option. We expect the argTypes.iterator.next() to be String.

      Output Without debug option:
      test.Bar
      testHolder
      ann.Holder<java.lang.String>
      1
      argsTypes.iterator().next(): java.lang.String

      Output With debug option:
      test.Bar
      testHolder
      ann.Holder
      0

            Unassigned Unassigned
            ramap Rama Pulavarthi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: