Make sure the generated code uses fully qualified names when referencing java.lang.Object
authorJaroslav Tulach <jtulach@netbeans.org>
Fri, 15 Jan 2016 11:41:37 +0100
changeset 1042e633fed12064
parent 1041 36165f49f598
child 1043 b189d001b9bd
Make sure the generated code uses fully qualified names when referencing java.lang.Object
boot/src/main/java/org/netbeans/html/boot/impl/JavaScriptProcesor.java
boot/src/test/java/org/netbeans/html/boot/impl/Object.java
     1.1 --- a/boot/src/main/java/org/netbeans/html/boot/impl/JavaScriptProcesor.java	Fri Jan 15 11:40:28 2016 +0100
     1.2 +++ b/boot/src/main/java/org/netbeans/html/boot/impl/JavaScriptProcesor.java	Fri Jan 15 11:41:37 2016 +0100
     1.3 @@ -72,7 +72,6 @@
     1.4  import javax.lang.model.element.TypeElement;
     1.5  import javax.lang.model.element.VariableElement;
     1.6  import javax.lang.model.type.ArrayType;
     1.7 -import javax.lang.model.type.DeclaredType;
     1.8  import javax.lang.model.type.ExecutableType;
     1.9  import javax.lang.model.type.TypeKind;
    1.10  import javax.lang.model.type.TypeMirror;
    1.11 @@ -424,7 +423,7 @@
    1.12          StringBuilder convert = new StringBuilder();
    1.13          if (!isStatic) {
    1.14              if (selfObj) {
    1.15 -                source.append("Object self");
    1.16 +                source.append("java.lang.Object self");
    1.17                  convert.append("    if (p instanceof org.netbeans.html.boot.spi.Fn.FromJavaScript) {\n");
    1.18                  convert.append("      self").
    1.19                          append(" = ((org.netbeans.html.boot.spi.Fn.FromJavaScript)p).toJava(self").
    1.20 @@ -443,7 +442,7 @@
    1.21              ++cnt;
    1.22              final TypeMirror t = ve.asType();
    1.23              if (!t.getKind().isPrimitive() && !"java.lang.String".equals(t.toString())) { // NOI18N
    1.24 -                source.append("Object");
    1.25 +                source.append("java.lang.Object");
    1.26                  convert.append("    if (p instanceof org.netbeans.html.boot.spi.Fn.FromJavaScript) {\n");
    1.27                  convert.append("      arg").append(cnt).
    1.28                          append(" = ((org.netbeans.html.boot.spi.Fn.FromJavaScript)p).toJava(arg").append(cnt).
    1.29 @@ -464,7 +463,7 @@
    1.30          }
    1.31          source.append("    ");
    1.32          if (m.getReturnType().getKind() != TypeKind.VOID) {
    1.33 -            source.append("Object $ret = ");
    1.34 +            source.append("java.lang.Object $ret = ");
    1.35          }
    1.36          if (isStatic) {
    1.37              source.append(((TypeElement)m.getEnclosingElement()).getQualifiedName());
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/boot/src/test/java/org/netbeans/html/boot/impl/Object.java	Fri Jan 15 11:41:37 2016 +0100
     2.3 @@ -0,0 +1,49 @@
     2.4 +/**
     2.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     2.6 + *
     2.7 + * Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
     2.8 + *
     2.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    2.10 + * Other names may be trademarks of their respective owners.
    2.11 + *
    2.12 + * The contents of this file are subject to the terms of either the GNU
    2.13 + * General Public License Version 2 only ("GPL") or the Common
    2.14 + * Development and Distribution License("CDDL") (collectively, the
    2.15 + * "License"). You may not use this file except in compliance with the
    2.16 + * License. You can obtain a copy of the License at
    2.17 + * http://www.netbeans.org/cddl-gplv2.html
    2.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    2.19 + * specific language governing permissions and limitations under the
    2.20 + * License.  When distributing the software, include this License Header
    2.21 + * Notice in each file and include the License file at
    2.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    2.23 + * particular file as subject to the "Classpath" exception as provided
    2.24 + * by Oracle in the GPL Version 2 section of the License file that
    2.25 + * accompanied this code. If applicable, add the following below the
    2.26 + * License Header, with the fields enclosed by brackets [] replaced by
    2.27 + * your own identifying information:
    2.28 + * "Portions Copyrighted [year] [name of copyright owner]"
    2.29 + *
    2.30 + * Contributor(s):
    2.31 + *
    2.32 + * The Original Software is NetBeans. The Initial Developer of the Original
    2.33 + * Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
    2.34 + *
    2.35 + * If you wish your version of this file to be governed by only the CDDL
    2.36 + * or only the GPL Version 2, indicate your decision by adding
    2.37 + * "[Contributor] elects to include this software in this distribution
    2.38 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    2.39 + * single choice of license, a recipient has the option to distribute
    2.40 + * your version of this file under either the CDDL, the GPL Version 2 or
    2.41 + * to extend the choice of license to its licensees as provided above.
    2.42 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    2.43 + * Version 2 license, then the option applies only if the new code is
    2.44 + * made subject to such option by the copyright holder.
    2.45 + */
    2.46 +package org.netbeans.html.boot.impl;
    2.47 +
    2.48 +/** Fake class to cause confusion in the generated code and force it
    2.49 + * to use fully qualified names
    2.50 + */
    2.51 +final class Object {
    2.52 +}