This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 190123
Collapse All | Expand All

(-)file_not_specified_in_diff (-5 / +63 lines)
Line  Link Here
0
-- a/java.source/apichanges.xml
0
++ b/java.source/apichanges.xml
Lines 108-113 Link Here
108
    <!-- ACTUAL CHANGES BEGIN HERE: -->
108
    <!-- ACTUAL CHANGES BEGIN HERE: -->
109
109
110
    <changes>
110
    <changes>
111
        <change id="TreeMaker.QualIdent_String">
112
             <api name="general"/>
113
             <summary>Added TreeMaker.QualIdent(String) and TreeMaker.Type(String) method.</summary>
114
             <version major="0" minor="64"/>
115
             <date day="8" month="9" year="2010"/>
116
             <author login="jlahoda"/>
117
             <compatibility addition="yes" binary="compatible" deletion="no" deprecation="no" modification="no" semantic="compatible" source="compatible"/>
118
             <description>
119
                 Added <code>TreeMaker.QualIdent(String)</code> and <code>TreeMaker.Type(String)</code> method, which allow
120
                 to construct QualIdents and Types from String specification.
121
             </description>
122
             <class package="org.netbeans.api.java.source" name="TreeMaker"/>
123
             <issue number="999999"/>
124
        </change>
111
        <change id="TreeUtilities.translate">
125
        <change id="TreeUtilities.translate">
112
             <api name="general"/>
126
             <api name="general"/>
113
             <summary>Added TreeUtilities.translate method.</summary>
127
             <summary>Added TreeUtilities.translate method.</summary>
114
-- a/java.source/nbproject/project.properties
128
++ b/java.source/nbproject/project.properties
Lines 46-52 Link Here
46
javadoc.title=Java Source
46
javadoc.title=Java Source
47
javadoc.arch=${basedir}/arch.xml
47
javadoc.arch=${basedir}/arch.xml
48
javadoc.apichanges=${basedir}/apichanges.xml
48
javadoc.apichanges=${basedir}/apichanges.xml
49
spec.version.base=0.63.0
49
spec.version.base=0.64.0
50
test.qa-functional.cp.extra=${refactoring.java.dir}/modules/ext/javac-api-nb-7.0-b07.jar
50
test.qa-functional.cp.extra=${refactoring.java.dir}/modules/ext/javac-api-nb-7.0-b07.jar
51
test.unit.run.cp.extra=${o.n.core.dir}/core/core.jar:\
51
test.unit.run.cp.extra=${o.n.core.dir}/core/core.jar:\
52
    ${o.n.core.dir}/lib/boot.jar:\
52
    ${o.n.core.dir}/lib/boot.jar:\
Lines 128-134 Link Here
128
    org/netbeans/api/java/source/CommentCollectorTest.class,\
128
    org/netbeans/api/java/source/CommentCollectorTest.class,\
129
    org/netbeans/api/java/source/gen/RewriteInCommentTest.class,\
129
    org/netbeans/api/java/source/gen/RewriteInCommentTest.class,\
130
    org/netbeans/api/java/source/gen/MoveTreeTest.class,\
130
    org/netbeans/api/java/source/gen/MoveTreeTest.class,\
131
    org/netbeans/api/java/source/gen/BlockTest.class
131
    org/netbeans/api/java/source/gen/BlockTest.class,\
132
    org/netbeans/api/java/source/gen/ImportAnalysisTest.class,\
133
    org/netbeans/api/java/source/gen/ImportAnalysis2Test.class
132
134
133
test.config.jet-main.includes=${test.config.generator.includes},\
135
test.config.jet-main.includes=${test.config.generator.includes},\
134
    org/netbeans/api/java/source/TypeUtilitiesTest.class
136
    org/netbeans/api/java/source/TypeUtilitiesTest.class
135
-- a/java.source/src/org/netbeans/api/java/source/TreeMaker.java
137
++ b/java.source/src/org/netbeans/api/java/source/TreeMaker.java
Lines 43-48 Link Here
43
 */
43
 */
44
package org.netbeans.api.java.source;
44
package org.netbeans.api.java.source;
45
45
46
import java.util.Map;
46
import com.sun.source.tree.*;
47
import com.sun.source.tree.*;
47
import org.netbeans.modules.java.source.parsing.FileObjects;
48
import org.netbeans.modules.java.source.parsing.FileObjects;
48
import org.openide.filesystems.FileObject;
49
import org.openide.filesystems.FileObject;
Lines 56-61 Link Here
56
import com.sun.tools.javac.code.Flags;
57
import com.sun.tools.javac.code.Flags;
57
import com.sun.tools.javac.tree.JCTree;
58
import com.sun.tools.javac.tree.JCTree;
58
import com.sun.tools.javac.tree.JCTree.JCModifiers;
59
import com.sun.tools.javac.tree.JCTree.JCModifiers;
60
import java.util.HashMap;
59
import javax.lang.model.element.*;
61
import javax.lang.model.element.*;
60
import javax.lang.model.type.*;
62
import javax.lang.model.type.*;
61
import javax.tools.JavaFileObject;
63
import javax.tools.JavaFileObject;
Lines 806-811 Link Here
806
        Parameters.notNull("element", element);
808
        Parameters.notNull("element", element);
807
        return delegate.QualIdent(element);
809
        return delegate.QualIdent(element);
808
    }
810
    }
811
812
    /**
813
     * Creates a qualified identifier for a given String.
814
     *
815
     * @param name FQN for which to create the QualIdent
816
     * @since 0.64
817
     */
818
    public @NonNull ExpressionTree QualIdent(@NonNull String name) {
819
        Parameters.notNull("name", name);
820
        return delegate.QualIdent(name);
821
    }
809
    
822
    
810
    /**
823
    /**
811
     * Creates a new ReturnTree.
824
     * Creates a new ReturnTree.
Lines 875-880 Link Here
875
    }
888
    }
876
889
877
    /**
890
    /**
891
     * Creates a new Tree for a given String type specification.
892
     *
893
     * @param type       String type specification
894
     * @see com.sun.source.tree.ExpressionTree
895
     * @since 0.64
896
     */
897
    public @NonNull Tree Type(@NonNull String type) {
898
        Parameters.notNull("type", type);
899
900
        Tree typeTree = copy.getTreeUtilities().parseType(type);
901
        final Map<Tree, Tree> translate = new HashMap<Tree, Tree>();
902
903
        new TreeScanner<Void, Void>() {
904
            @Override
905
            public Void visitMemberSelect(MemberSelectTree node, Void p) {
906
                translate.put(node, QualIdent(node.toString()));
907
                return null;
908
            }
909
            @Override
910
            public Void visitIdentifier(IdentifierTree node, Void p) {
911
                translate.put(node, QualIdent(node.toString()));
912
                return null;
913
            }
914
        }.scan(typeTree, null);
915
916
        return copy.getTreeUtilities().translate(typeTree, translate);
917
    }
918
919
    /**
878
     * Creates a new TypeCastTree.
920
     * Creates a new TypeCastTree.
879
     *
921
     *
880
     * @param type       the class or interface to cast.
922
     * @param type       the class or interface to cast.

Return to bug 190123