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 209828
Collapse All | Expand All

(-)3b8d63726d11 (+151 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!-- Search for CHANGEME in this document when copying and using it: -->
3
<!--
4
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5
6
Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
7
8
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
9
Other names may be trademarks of their respective owners.
10
11
The contents of this file are subject to the terms of either the GNU
12
General Public License Version 2 only ("GPL") or the Common
13
Development and Distribution License("CDDL") (collectively, the
14
"License"). You may not use this file except in compliance with the
15
License. You can obtain a copy of the License at
16
http://www.netbeans.org/cddl-gplv2.html
17
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
18
specific language governing permissions and limitations under the
19
License.  When distributing the software, include this License Header
20
Notice in each file and include the License file at
21
nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
22
particular file as subject to the "Classpath" exception as provided
23
by Oracle in the GPL Version 2 section of the License file that
24
accompanied this code. If applicable, add the following below the
25
License Header, with the fields enclosed by brackets [] replaced by
26
your own identifying information:
27
"Portions Copyrighted [year] [name of copyright owner]"
28
29
Contributor(s):
30
31
The Original Software is NetBeans. The Initial Developer of the Original
32
Software is Sun Microsystems, Inc. Portions Copyright 1997-2010 Sun
33
Microsystems, Inc. All Rights Reserved.
34
35
If you wish your version of this file to be governed by only the CDDL
36
or only the GPL Version 2, indicate your decision by adding
37
"[Contributor] elects to include this software in this distribution
38
under the [CDDL or GPL Version 2] license." If you do not indicate a
39
single choice of license, a recipient has the option to distribute
40
your version of this file under either the CDDL, the GPL Version 2 or
41
to extend the choice of license to its licensees as provided above.
42
However, if you add GPL Version 2 code and therefore, elected the GPL
43
Version 2 license, then the option applies only if the new code is
44
made subject to such option by the copyright holder.
45
-->
46
<?xml-stylesheet type="text/xml" href="../nbbuild/javadoctools/apichanges.xsl"?>
47
<!DOCTYPE apichanges PUBLIC "-//NetBeans//DTD API changes list 1.0//EN" "../nbbuild/javadoctools/apichanges.dtd">
48
49
<!--
50
51
INFO FOR PEOPLE ADDING CHANGES:
52
53
Check the DTD (apichanges.dtd) for details on the syntax. You do not
54
need to regenerate the HTML, as this is part of Javadoc generation; just
55
change the XML. Rough syntax of a change (several parts optional):
56
57
<change>
58
    <api name="compiler"/>
59
    <summary>Some brief description here, can use <b>XHTML</b></summary>
60
    <version major="1" minor="99"/>
61
    <date day="13" month="6" year="2001"/>
62
    <author login="jrhacker"/>
63
    <compatibility addition="yes"/>
64
    <description>
65
        The main description of the change here.
66
        Again can use full <b>XHTML</b> as needed.
67
    </description>
68
    <class package="org.openide.compiler" name="DoWhatIWantCompiler"/>
69
    <issue number="14309"/>
70
</change>
71
72
Also permitted elements: <package>, <branch>. <version> is API spec
73
version, recommended for all new changes. <compatibility> should say
74
if things were added/modified/deprecated/etc. and give all information
75
related to upgrading old code. List affected top-level classes and
76
link to issue numbers if applicable. See the DTD for more details.
77
78
Changes need not be in any particular order, they are sorted in various
79
ways by the stylesheet anyway.
80
81
Dates are assumed to mean "on the trunk". If you *also* make the same
82
change on a stabilization branch, use the <branch> tag to indicate this
83
and explain why the change was made on a branch in the <description>.
84
85
Please only change this file on the trunk! Rather: you can change it
86
on branches if you want, but these changes will be ignored; only the
87
trunk version of this file is important.
88
89
Deprecations do not count as incompatible, assuming that code using the
90
deprecated calls continues to see their documented behavior. But do
91
specify deprecation="yes" in <compatibility>.
92
93
This file is not a replacement for Javadoc: it is intended to list changes,
94
not describe the complete current behavior, for which ordinary documentation
95
is the proper place.
96
97
-->
98
99
<apichanges>
100
101
    <!-- First, a list of API names you may use: -->
102
    <apidefs>
103
        <apidef name="JavaHintsTest">Java Hints Test API</apidef>
104
    </apidefs>
105
106
    <!-- ACTUAL CHANGES BEGIN HERE: -->
107
108
    <changes>
109
110
        <change id="HintWarning-assertFixes">
111
             <api name="JavaHintsTest"/>
112
             <summary>Added assertFixes method to HintWarning</summary>
113
             <version major="1" minor="1"/>
114
             <date day="28" month="3" year="2012"/>
115
             <author login="jlahoda"/>
116
             <compatibility addition="yes" binary="compatible" deletion="no" deprecation="no" modification="no" semantic="compatible" source="compatible"/>
117
             <description>
118
                 Added assertFixes method to HintWarning
119
             </description>
120
             <class name="HintTest" package="org.netbeans.modules.java.hints.test.api"/>
121
             <issue number="209828"/>
122
        </change>
123
124
    </changes>
125
126
    <!-- Now the surrounding HTML text and document structure: -->
127
128
    <htmlcontents>
129
<!-- Generated from apichanges.xml -->
130
    <head>
131
      <title>Change History for the Editor Hints SPI</title>
132
      <link rel="stylesheet" href="prose.css" type="text/css"/>
133
    </head>
134
    <body>
135
136
<p class="overviewlink"><a href="@TOP@/overview-summary.html">Overview</a></p>
137
138
<h1>Introduction</h1>
139
140
<p>This document lists changes made to the <a href="@TOP@/overview-summary.html">Editor Hints SPI</a>.</p>
141
142
<!-- The actual lists of changes, as summaries and details: -->
143
      <hr/>
144
      <standard-changelists module-code-name="org.netbeans.spi.editor.hints/0"/>
145
146
      <hr/><p>@FOOTER@</p>
147
148
    </body>
149
  </htmlcontents>
150
151
</apichanges>
(-)a/java.hints.test/nbproject/project.properties (-1 / +2 lines)
Lines 1-6 Link Here
1
is.autoload=true
1
is.autoload=true
2
javac.source=1.6
2
javac.source=1.6
3
javac.compilerargs=-Xlint -Xlint:-serial
3
javac.compilerargs=-Xlint -Xlint:-serial
4
spec.version.base=1.0
4
spec.version.base=1.1
5
javadoc.arch=${basedir}/arch.xml
5
javadoc.arch=${basedir}/arch.xml
6
javadoc.apichanges=${basedir}/apichanges.xml
6
requires.nb.javac=true
7
requires.nb.javac=true
(-)a/java.hints.test/src/org/netbeans/modules/java/hints/test/api/HintTest.java (+22 lines)
Lines 94-99 Link Here
94
import org.netbeans.modules.java.hints.providers.spi.HintDescription;
94
import org.netbeans.modules.java.hints.providers.spi.HintDescription;
95
import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
95
import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
96
import org.netbeans.modules.java.hints.spiimpl.MessageImpl;
96
import org.netbeans.modules.java.hints.spiimpl.MessageImpl;
97
import org.netbeans.modules.java.hints.spiimpl.SyntheticFix;
97
import org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker;
98
import org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker;
98
import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
99
import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
99
import org.netbeans.modules.java.hints.test.Utilities.TestLookup;
100
import org.netbeans.modules.java.hints.test.Utilities.TestLookup;
Lines 839-844 Link Here
839
840
840
            return new AppliedFix();
841
            return new AppliedFix();
841
        }
842
        }
843
        /**Verifies that the current warning provides the given fixes.
844
         *
845
         * @param fixes the {@link Fix#getText() } of the expected fixes
846
         * @return itself
847
         * @throws AssertionError if the expected fixes do not match the provided fixes
848
         * @since 1.1
849
         */
850
        public HintWarning assertFixes(String... expectedFixes) throws Exception {
851
            assertTrue("Must be computed", warning.getFixes().isComputed());
852
853
            List<String> fixNames = new LinkedList<String>();
854
855
            for (Fix f : warning.getFixes().getFixes()) {
856
                if (f instanceof SyntheticFix) continue;
857
                fixNames.add(f.getText());
858
            }
859
860
            assertEquals("Fixes for the current warning do not match the expected fixes. All fixes: " + fixNames.toString(), Arrays.asList(expectedFixes), fixNames);
861
862
            return this;
863
        }
842
    }
864
    }
843
865
844
    /**A wrapper over result after applying a fix.
866
    /**A wrapper over result after applying a fix.
(-)a/java.hints/test/unit/src/org/netbeans/modules/java/hints/perf/TinyTest.java (+14 lines)
Lines 457-460 Link Here
457
                              "     }\n" +
457
                              "     }\n" +
458
                              "}\n");
458
                              "}\n");
459
    }
459
    }
460
461
    public void testCollectionsToArray2() throws Exception {
462
        HintTest.create()
463
                .input("package test;\n" +
464
                       "public class Test {\n" +
465
                       "     private java.util.Collection<String> col() { return null; }\n" +
466
                       "     private String[] test() {\n" +
467
                       "         return col().toArray(new String[0]);\n" +
468
                       "     }\n" +
469
                       "}\n")
470
                .run(Tiny.class)
471
                .findWarning("4:22-4:29:verifier:ERR_Tiny_collectionsToArray")
472
                .assertFixes();
473
    }
460
}
474
}

Return to bug 209828