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

(-)a/cnd.asm/nbproject/project.xml (-1 / +1 lines)
Lines 137-143 Link Here
137
                    <build-prerequisite/>
137
                    <build-prerequisite/>
138
                    <compile-dependency/>
138
                    <compile-dependency/>
139
                    <run-dependency>
139
                    <run-dependency>
140
                        <specification-version>8.0</specification-version>
140
                        <specification-version>8.32</specification-version>
141
                    </run-dependency>
141
                    </run-dependency>
142
                </dependency>
142
                </dependency>
143
                <dependency>
143
                <dependency>
(-)a/cnd.asm/src/org/netbeans/modules/cnd/asm/core/assistance/GoToLabelAction.java (-4 / +4 lines)
Lines 47-53 Link Here
47
47
48
import org.netbeans.modules.cnd.asm.model.AsmState;
48
import org.netbeans.modules.cnd.asm.model.AsmState;
49
import org.netbeans.modules.cnd.asm.model.lang.AsmElement;
49
import org.netbeans.modules.cnd.asm.model.lang.AsmElement;
50
import org.netbeans.modules.cnd.asm.model.util.Pair;
50
import org.openide.util.Pair;
51
51
52
public class GoToLabelAction {
52
public class GoToLabelAction {
53
                
53
                
Lines 55-63 Link Here
55
        Pair<AsmElement, AsmElement> pair = state.resolveLink(pos);
55
        Pair<AsmElement, AsmElement> pair = state.resolveLink(pos);
56
        
56
        
57
        if (pair != null) {
57
        if (pair != null) {
58
            return new int[] { pair.getFirst().getStartOffset(), 
58
            return new int[] { pair.first().getStartOffset(),
59
                               pair.getFirst().getEndOffset(), 
59
                               pair.first().getEndOffset(),
60
                               pair.getSecond().getStartOffset()
60
                               pair.second().getStartOffset()
61
                             };                        
61
                             };                        
62
        } 
62
        } 
63
        
63
        
(-)a/cnd.asm/src/org/netbeans/modules/cnd/asm/core/editor/AsmModelAccessorImpl.java (-2 / +2 lines)
Lines 72-78 Link Here
72
import org.netbeans.modules.cnd.asm.model.lang.syntax.AsmParser;
72
import org.netbeans.modules.cnd.asm.model.lang.syntax.AsmParser;
73
import org.netbeans.modules.cnd.asm.model.util.AsmModelUtilities;
73
import org.netbeans.modules.cnd.asm.model.util.AsmModelUtilities;
74
import org.netbeans.modules.cnd.asm.model.util.EmptyAsmState;
74
import org.netbeans.modules.cnd.asm.model.util.EmptyAsmState;
75
import org.netbeans.modules.cnd.asm.model.util.Pair;
75
import org.openide.util.Pair;
76
76
77
public class AsmModelAccessorImpl implements AsmModelAccessor {            
77
public class AsmModelAccessorImpl implements AsmModelAccessor {            
78
    
78
    
Lines 215-221 Link Here
215
                AsmElement result = resolver.getResult();
215
                AsmElement result = resolver.getResult();
216
                
216
                
217
                if (result != null) {
217
                if (result != null) {
218
                    return Pair.getPair(inital, result);
218
                    return Pair.<AsmElement, AsmElement>of(inital, result);
219
                }
219
                }
220
            }
220
            }
221
                
221
                
(-)a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/AsmState.java (-1 / +1 lines)
Lines 48-54 Link Here
48
import org.openide.util.Lookup;
48
import org.openide.util.Lookup;
49
49
50
import org.netbeans.modules.cnd.asm.model.lang.AsmElement;
50
import org.netbeans.modules.cnd.asm.model.lang.AsmElement;
51
import org.netbeans.modules.cnd.asm.model.util.Pair;
51
import org.openide.util.Pair;
52
52
53
public interface AsmState {
53
public interface AsmState {
54
    AsmElement getElements();  
54
    AsmElement getElements();  
(-)a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/util/EmptyAsmState.java (+1 lines)
Lines 36-41 Link Here
36
import org.netbeans.modules.cnd.asm.model.AsmState;
36
import org.netbeans.modules.cnd.asm.model.AsmState;
37
import org.netbeans.modules.cnd.asm.model.lang.AsmElement;
37
import org.netbeans.modules.cnd.asm.model.lang.AsmElement;
38
import org.netbeans.modules.cnd.asm.model.lang.impl.LeafAsmElement;
38
import org.netbeans.modules.cnd.asm.model.lang.impl.LeafAsmElement;
39
import org.openide.util.Pair;
39
40
40
public class EmptyAsmState implements AsmState,
41
public class EmptyAsmState implements AsmState,
41
                              AsmFakeable {
42
                              AsmFakeable {
(-)a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/util/Pair.java (-68 lines)
Lines 1-68 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
45
46
package org.netbeans.modules.cnd.asm.model.util;
47
48
public class Pair<T1, T2> {
49
    private final T1 p1; 
50
    private final T2 p2; 
51
    
52
    public Pair(T1 p1, T2 p2) {
53
        this.p1 = p1;
54
        this.p2 = p2;
55
    }
56
    
57
    public T1 getFirst() {
58
        return p1;
59
    }
60
    
61
    public T2 getSecond() {
62
        return p2;
63
    }    
64
    
65
    public static <T1, T2> Pair<T1, T2> getPair(T1 p1, T2 p2) {
66
        return new Pair<T1,T2>(p1, p2);
67
    }
68
}
(-)a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/xml/ModelXMLRootContext.java (-3 / +3 lines)
Lines 58-68 Link Here
58
import org.xml.sax.Attributes;
58
import org.xml.sax.Attributes;
59
59
60
import org.netbeans.modules.cnd.asm.model.lang.BitWidth;
60
import org.netbeans.modules.cnd.asm.model.lang.BitWidth;
61
import org.netbeans.modules.cnd.asm.model.util.Pair;
62
import org.netbeans.modules.cnd.asm.model.lang.instruction.Instruction;
61
import org.netbeans.modules.cnd.asm.model.lang.instruction.Instruction;
63
import org.netbeans.modules.cnd.asm.model.lang.Register;
62
import org.netbeans.modules.cnd.asm.model.lang.Register;
64
import org.netbeans.modules.cnd.asm.model.lang.instruction.InstructionArgs;
63
import org.netbeans.modules.cnd.asm.model.lang.instruction.InstructionArgs;
65
import static org.netbeans.modules.cnd.asm.model.xml.ModelXMLAttributes.*;
64
import static org.netbeans.modules.cnd.asm.model.xml.ModelXMLAttributes.*;
65
import org.openide.util.Pair;
66
66
67
public class ModelXMLRootContext implements XMLReaderContext {
67
public class ModelXMLRootContext implements XMLReaderContext {
68
        
68
        
Lines 181-187 Link Here
181
                     XMLBaseRegister result = new DefaultXMLBaseRegister(ctx.getName(), ctx.getWidth());
181
                     XMLBaseRegister result = new DefaultXMLBaseRegister(ctx.getName(), ctx.getWidth());
182
                     Set<Register> children = new HashSet<Register>();
182
                     Set<Register> children = new HashSet<Register>();
183
                     for (Pair<String, Integer> pair : ctx.getChildren()) {
183
                     for (Pair<String, Integer> pair : ctx.getChildren()) {
184
                         XMLBaseRegister res = process(getForName(pair.getFirst())); 
184
                         XMLBaseRegister res = process(getForName(pair.first()));
185
                         children.addAll(res.getChildren());
185
                         children.addAll(res.getChildren());
186
                         children.add(res);
186
                         children.add(res);
187
                         res.setDirectParent(result);
187
                         res.setDirectParent(result);
Lines 230-236 Link Here
230
                String name = checkForName(attributes, REG_NAME_ATTRIBUTE); 
230
                String name = checkForName(attributes, REG_NAME_ATTRIBUTE); 
231
                String offset = checkForName(attributes, REG_OFFSET_ATTRIBUTE);
231
                String offset = checkForName(attributes, REG_OFFSET_ATTRIBUTE);
232
                
232
                
233
                children.add(new Pair<String, Integer>(name, Integer.parseInt(offset)));
233
                children.add(Pair.<String, Integer>of(name, Integer.parseInt(offset)));
234
                return null;
234
                return null;
235
            }
235
            }
236
            
236
            
(-)a/cnd.repository/nbproject/project.xml (-1 / +1 lines)
Lines 43-49 Link Here
43
                    <build-prerequisite/>
43
                    <build-prerequisite/>
44
                    <compile-dependency/>
44
                    <compile-dependency/>
45
                    <run-dependency>
45
                    <run-dependency>
46
                        <specification-version>8.0</specification-version>
46
                        <specification-version>8.32</specification-version>
47
                    </run-dependency>
47
                    </run-dependency>
48
                </dependency>
48
                </dependency>
49
                <dependency>
49
                <dependency>
(-)a/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/MemoryCache.java (-2 / +2 lines)
Lines 60-67 Link Here
60
import org.netbeans.modules.cnd.debug.CndTraceFlags;
60
import org.netbeans.modules.cnd.debug.CndTraceFlags;
61
import org.netbeans.modules.cnd.repository.spi.Key;
61
import org.netbeans.modules.cnd.repository.spi.Key;
62
import org.netbeans.modules.cnd.repository.spi.Persistent;
62
import org.netbeans.modules.cnd.repository.spi.Persistent;
63
import org.netbeans.modules.cnd.repository.util.Pair;
64
import org.netbeans.modules.cnd.utils.CndUtils;
63
import org.netbeans.modules.cnd.utils.CndUtils;
64
import org.openide.util.Pair;
65
65
66
/**
66
/**
67
 * An in-memory cache for storing repository objects 
67
 * An in-memory cache for storing repository objects 
Lines 380-386 Link Here
380
                    s.r.unlock();
380
                    s.r.unlock();
381
                }
381
                }
382
                if (value instanceof Persistent ) {
382
                if (value instanceof Persistent ) {
383
                    result.add(new Pair<Key,Persistent>(key, (Persistent) value));
383
                    result.add(Pair.<Key,Persistent>of(key, (Persistent) value));
384
                    s.w.lock();
384
                    s.w.lock();
385
                    try {
385
                    try {
386
                        s.storage.remove(key);
386
                        s.storage.remove(key);
(-)a/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/UnitImpl.java (-2 / +2 lines)
Lines 56-64 Link Here
56
import org.netbeans.modules.cnd.repository.spi.Key;
56
import org.netbeans.modules.cnd.repository.spi.Key;
57
import org.netbeans.modules.cnd.repository.spi.Key.Behavior;
57
import org.netbeans.modules.cnd.repository.spi.Key.Behavior;
58
import org.netbeans.modules.cnd.repository.spi.Persistent;
58
import org.netbeans.modules.cnd.repository.spi.Persistent;
59
import org.netbeans.modules.cnd.repository.util.Pair;
60
import org.netbeans.modules.cnd.utils.CndUtils;
59
import org.netbeans.modules.cnd.utils.CndUtils;
61
import org.openide.util.Lookup;
60
import org.openide.util.Lookup;
61
import org.openide.util.Pair;
62
62
63
/**
63
/**
64
 * Implements a repository unit
64
 * Implements a repository unit
Lines 197-203 Link Here
197
    public void close() throws IOException {
197
    public void close() throws IOException {
198
        Collection<Pair<Key, Persistent>> hung = cache.clearHungObjects();
198
        Collection<Pair<Key, Persistent>> hung = cache.clearHungObjects();
199
        for( Pair<Key, Persistent> pair : hung ) {
199
        for( Pair<Key, Persistent> pair : hung ) {
200
            putPhysically(pair.first, pair.second);
200
            putPhysically(pair.first(), pair.second());
201
        }
201
        }
202
        singleFileStorage.close();
202
        singleFileStorage.close();
203
        multyFileStorage.close();
203
        multyFileStorage.close();
(-)a/cnd.repository/src/org/netbeans/modules/cnd/repository/util/Pair.java (-59 lines)
Lines 1-59 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 * 
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 * 
38
 * Contributor(s):
39
 * 
40
 * Portions Copyrighted 2008 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.cnd.repository.util;
44
45
/**
46
 * A simple struct, mainly for returning pairs of values
47
 * @author Vladimir Kvashin
48
 */
49
public class Pair<T1, T2> {
50
    
51
    public final T1 first;
52
    public final T2 second;
53
    
54
    public Pair(T1 first, T2 second) {
55
        this.first = first;
56
        this.second = second;
57
    }
58
    
59
}
(-)a/csl.api/nbproject/project.xml (-1 / +1 lines)
Lines 358-364 Link Here
358
                    <build-prerequisite/>
358
                    <build-prerequisite/>
359
                    <compile-dependency/>
359
                    <compile-dependency/>
360
                    <run-dependency>
360
                    <run-dependency>
361
                        <specification-version>8.0</specification-version>
361
                        <specification-version>8.32</specification-version>
362
                    </run-dependency>
362
                    </run-dependency>
363
                </dependency>
363
                </dependency>
364
                <dependency>
364
                <dependency>
(-)a/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/GsfHintsManager.java (-8 / +9 lines)
Lines 89-94 Link Here
89
import org.openide.filesystems.FileUtil;
89
import org.openide.filesystems.FileUtil;
90
import org.openide.loaders.DataObject;
90
import org.openide.loaders.DataObject;
91
import org.openide.util.Exceptions;
91
import org.openide.util.Exceptions;
92
import org.openide.util.Pair;
92
93
93
/**
94
/**
94
 *
95
 *
Lines 322-335 Link Here
322
                    r = instantiateRule(o);
323
                    r = instantiateRule(o);
323
                }
324
                }
324
                if ( r != null ) {
325
                if ( r != null ) {
325
                    rules.add( new Pair<Rule,FileObject>( r, o ) );
326
                    rules.add( Pair.<Rule,FileObject>of( r, o ) );
326
                }
327
                }
327
            }
328
            }
328
        }
329
        }
329
        Collections.sort(rules, new Comparator<Pair<Rule,FileObject>>() {
330
        Collections.sort(rules, new Comparator<Pair<Rule,FileObject>>() {
330
            @Override
331
            @Override
331
            public int compare(Pair<Rule,FileObject> p1, Pair<Rule,FileObject> p2) {
332
            public int compare(Pair<Rule,FileObject> p1, Pair<Rule,FileObject> p2) {
332
                return p1.getA().getDisplayName().compareTo(p2.getA().getDisplayName());
333
                return p1.first().getDisplayName().compareTo(p2.first().getDisplayName());
333
            }
334
            }
334
        });
335
        });
335
        return rules;
336
        return rules;
Lines 366-373 Link Here
366
        dir2node.put(rootFolder, rootNode);
367
        dir2node.put(rootFolder, rootNode);
367
368
368
        for( Pair<Rule,FileObject> pair : rules ) {
369
        for( Pair<Rule,FileObject> pair : rules ) {
369
            Rule rule = pair.getA();
370
            Rule rule = pair.first();
370
            FileObject fo = pair.getB();
371
            FileObject fo = pair.second();
371
372
372
            if ( rule instanceof ErrorRule ) {
373
            if ( rule instanceof ErrorRule ) {
373
                addRule( (ErrorRule)rule, (Map)dest );
374
                addRule( (ErrorRule)rule, (Map)dest );
Lines 395-402 Link Here
395
        dir2node.put(rootFolder, rootNode);
396
        dir2node.put(rootFolder, rootNode);
396
397
397
        for( Pair<Rule,FileObject> pair : rules ) {
398
        for( Pair<Rule,FileObject> pair : rules ) {
398
            Rule rule = pair.getA();
399
            Rule rule = pair.first();
399
            FileObject fo = pair.getB();
400
            FileObject fo = pair.second();
400
401
401
            if ( rule instanceof AstRule ) {
402
            if ( rule instanceof AstRule ) {
402
                
403
                
Lines 436-443 Link Here
436
        dir2node.put(rootFolder, rootNode);
437
        dir2node.put(rootFolder, rootNode);
437
438
438
        for( Pair<Rule,FileObject> pair : rules ) {
439
        for( Pair<Rule,FileObject> pair : rules ) {
439
            Rule rule = pair.getA();
440
            Rule rule = pair.first();
440
            FileObject fo = pair.getB();
441
            FileObject fo = pair.second();
441
442
442
            if ( rule instanceof SelectionRule ) {
443
            if ( rule instanceof SelectionRule ) {
443
                addRule((SelectionRule)rule, (List)dest );
444
                addRule((SelectionRule)rule, (List)dest );
(-)a/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/Pair.java (-71 lines)
Lines 1-71 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
package org.netbeans.modules.csl.hints.infrastructure;
45
46
/**
47
 *
48
 * @author Jan Lahoda
49
 */
50
public final class Pair<A, B> {
51
52
    private final A a;
53
    private final B b;
54
55
    public Pair(A a, B b) {
56
        this.a = a;
57
        this.b = b;
58
    }
59
60
    public A getA() {
61
        return a;
62
    }
63
64
    public B getB() {
65
        return b;
66
    }
67
68
    public static <A,B> Pair<A,B> of(A a, B b) {
69
      return new Pair<A, B>(a, b);
70
    } 
71
}
(-)a/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java (-3 / +3 lines)
Lines 173-179 Link Here
173
import org.netbeans.modules.csl.editor.codetemplates.CslCorePackageAccessor;
173
import org.netbeans.modules.csl.editor.codetemplates.CslCorePackageAccessor;
174
import org.netbeans.modules.csl.hints.infrastructure.GsfHintsManager;
174
import org.netbeans.modules.csl.hints.infrastructure.GsfHintsManager;
175
import org.netbeans.modules.csl.hints.infrastructure.HintsSettings;
175
import org.netbeans.modules.csl.hints.infrastructure.HintsSettings;
176
import org.netbeans.modules.csl.hints.infrastructure.Pair;
177
import org.netbeans.modules.csl.spi.DefaultError;
176
import org.netbeans.modules.csl.spi.DefaultError;
178
import org.netbeans.modules.csl.spi.GsfUtilities;
177
import org.netbeans.modules.csl.spi.GsfUtilities;
179
import org.netbeans.modules.csl.spi.ParserResult;
178
import org.netbeans.modules.csl.spi.ParserResult;
Lines 207-212 Link Here
207
import org.openide.filesystems.XMLFileSystem;
206
import org.openide.filesystems.XMLFileSystem;
208
import org.openide.loaders.DataObject;
207
import org.openide.loaders.DataObject;
209
import org.openide.loaders.DataObjectNotFoundException;
208
import org.openide.loaders.DataObjectNotFoundException;
209
import org.openide.util.Pair;
210
import org.openide.util.test.MockLookup;
210
import org.openide.util.test.MockLookup;
211
211
212
/**
212
/**
Lines 3391-3397 Link Here
3391
            }
3391
            }
3392
        }
3392
        }
3393
3393
3394
        return new Pair<EditHistory,String>(history, modifiedText);
3394
        return Pair.<EditHistory,String>of(history, modifiedText);
3395
    }
3395
    }
3396
3396
3397
    protected final Pair<EditHistory,String> getEditHistory(BaseDocument doc, final EditHistory history, String... edits) throws BadLocationException {
3397
    protected final Pair<EditHistory,String> getEditHistory(BaseDocument doc, final EditHistory history, String... edits) throws BadLocationException {
Lines 3466-3472 Link Here
3466
            }
3466
            }
3467
        }
3467
        }
3468
3468
3469
        return new Pair<EditHistory,String>(history, modifiedText);
3469
        return Pair.<EditHistory,String>of(history, modifiedText);
3470
    }
3470
    }
3471
3471
3472
//    /**
3472
//    /**
(-)a/css.editor/manifest.mf (-1 / +1 lines)
Lines 2-6 Link Here
2
OpenIDE-Module: org.netbeans.modules.css.editor/1
2
OpenIDE-Module: org.netbeans.modules.css.editor/1
3
OpenIDE-Module-Layer: org/netbeans/modules/css/resources/layer.xml
3
OpenIDE-Module-Layer: org/netbeans/modules/css/resources/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/resources/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/resources/Bundle.properties
5
OpenIDE-Module-Specification-Version: 1.52
5
OpenIDE-Module-Specification-Version: 1.53
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
(-)a/css.editor/nbproject/project.xml (-2 / +2 lines)
Lines 179-185 Link Here
179
                    <build-prerequisite/>
179
                    <build-prerequisite/>
180
                    <compile-dependency/>
180
                    <compile-dependency/>
181
                    <run-dependency>
181
                    <run-dependency>
182
                        <specification-version>1.28</specification-version>
182
                        <specification-version>1.46</specification-version>
183
                    </run-dependency>
183
                    </run-dependency>
184
                </dependency>
184
                </dependency>
185
                <dependency>
185
                <dependency>
Lines 259-265 Link Here
259
                    <build-prerequisite/>
259
                    <build-prerequisite/>
260
                    <compile-dependency/>
260
                    <compile-dependency/>
261
                    <run-dependency>
261
                    <run-dependency>
262
                        <specification-version>8.0</specification-version>
262
                        <specification-version>8.32</specification-version>
263
                    </run-dependency>
263
                    </run-dependency>
264
                </dependency>
264
                </dependency>
265
                <dependency>
265
                <dependency>
(-)a/css.editor/src/org/netbeans/modules/css/editor/csl/CssDeclarationFinder.java (-3 / +3 lines)
Lines 51-57 Link Here
51
import org.netbeans.modules.css.editor.module.spi.FeatureCancel;
51
import org.netbeans.modules.css.editor.module.spi.FeatureCancel;
52
import org.netbeans.modules.css.editor.module.spi.FutureParamTask;
52
import org.netbeans.modules.css.editor.module.spi.FutureParamTask;
53
import org.netbeans.modules.css.lib.api.CssParserResult;
53
import org.netbeans.modules.css.lib.api.CssParserResult;
54
import org.netbeans.modules.web.common.api.Pair;
54
import org.openide.util.Pair;
55
55
56
/**
56
/**
57
 * Hyperlinking for @import declaration only.
57
 * Hyperlinking for @import declaration only.
Lines 80-87 Link Here
80
    public OffsetRange getReferenceSpan(Document doc, int caretOffset) {
80
    public OffsetRange getReferenceSpan(Document doc, int caretOffset) {
81
        Pair<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>> declarationLocation = CssModuleSupport.getDeclarationLocation(doc, caretOffset, new FeatureCancel());
81
        Pair<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>> declarationLocation = CssModuleSupport.getDeclarationLocation(doc, caretOffset, new FeatureCancel());
82
        if(declarationLocation != null) {
82
        if(declarationLocation != null) {
83
            taskRef.set(declarationLocation.getB());
83
            taskRef.set(declarationLocation.second());
84
            return declarationLocation.getA();
84
            return declarationLocation.first();
85
        }
85
        }
86
        return OffsetRange.NONE;
86
        return OffsetRange.NONE;
87
    }
87
    }
(-)a/css.editor/src/org/netbeans/modules/css/editor/module/CssModuleSupport.java (-1 / +1 lines)
Lines 55-63 Link Here
55
import org.netbeans.modules.css.lib.api.Node;
55
import org.netbeans.modules.css.lib.api.Node;
56
import org.netbeans.modules.css.lib.api.NodeVisitor;
56
import org.netbeans.modules.css.lib.api.NodeVisitor;
57
import org.netbeans.modules.css.lib.api.properties.PropertyDefinition;
57
import org.netbeans.modules.css.lib.api.properties.PropertyDefinition;
58
import org.netbeans.modules.web.common.api.Pair;
59
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileObject;
60
import org.openide.util.Lookup;
59
import org.openide.util.Lookup;
60
import org.openide.util.Pair;
61
61
62
/**
62
/**
63
 *
63
 *
(-)a/css.editor/src/org/netbeans/modules/css/editor/module/PropertiesReader.java (-2 / +3 lines)
Lines 48-56 Link Here
48
import java.util.ArrayList;
48
import java.util.ArrayList;
49
import java.util.Collection;
49
import java.util.Collection;
50
import java.util.Properties;
50
import java.util.Properties;
51
import org.netbeans.modules.web.common.api.Pair;
51
52
import org.openide.util.Exceptions;
52
import org.openide.util.Exceptions;
53
import org.openide.util.Lookup;
53
import org.openide.util.Lookup;
54
import org.openide.util.Pair;
54
55
55
/**
56
/**
56
 *
57
 *
Lines 152-158 Link Here
152
            }
153
            }
153
            String key = loadConvert(lr.lineBuf, 0, keyLen, convtBuf);
154
            String key = loadConvert(lr.lineBuf, 0, keyLen, convtBuf);
154
            String value = loadConvert(lr.lineBuf, valueStart, limit - valueStart, convtBuf);
155
            String value = loadConvert(lr.lineBuf, valueStart, limit - valueStart, convtBuf);
155
            col.add(new Pair<String, String>(key, value));
156
            col.add(Pair.<String, String>of(key, value));
156
        }
157
        }
157
    }
158
    }
158
159
(-)a/css.editor/src/org/netbeans/modules/css/editor/module/main/DefaultCssEditorModule.java (-2 / +2 lines)
Lines 80-89 Link Here
80
import org.netbeans.modules.parsing.api.Snapshot;
80
import org.netbeans.modules.parsing.api.Snapshot;
81
import org.netbeans.modules.web.common.api.LexerUtils;
81
import org.netbeans.modules.web.common.api.LexerUtils;
82
import org.netbeans.modules.web.common.api.Lines;
82
import org.netbeans.modules.web.common.api.Lines;
83
import org.netbeans.modules.web.common.api.Pair;
84
import org.netbeans.modules.web.common.api.WebUtils;
83
import org.netbeans.modules.web.common.api.WebUtils;
85
import org.openide.filesystems.FileObject;
84
import org.openide.filesystems.FileObject;
86
import org.openide.util.NbBundle;
85
import org.openide.util.NbBundle;
86
import org.openide.util.Pair;
87
import org.openide.util.lookup.ServiceProvider;
87
import org.openide.util.lookup.ServiceProvider;
88
88
89
/**
89
/**
Lines 479-485 Link Here
479
            }
479
            }
480
        };
480
        };
481
481
482
        return new Pair<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>>(foundRange, callable);
482
        return Pair.<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>>of(foundRange, callable);
483
    }
483
    }
484
484
485
    @Override
485
    @Override
(-)a/css.editor/src/org/netbeans/modules/css/editor/module/spi/CssEditorModule.java (-1 / +1 lines)
Lines 54-61 Link Here
54
import org.netbeans.modules.csl.api.OffsetRange;
54
import org.netbeans.modules.csl.api.OffsetRange;
55
import org.netbeans.modules.csl.api.StructureItem;
55
import org.netbeans.modules.csl.api.StructureItem;
56
import org.netbeans.modules.css.lib.api.NodeVisitor;
56
import org.netbeans.modules.css.lib.api.NodeVisitor;
57
import org.netbeans.modules.web.common.api.Pair;
58
import org.openide.filesystems.FileObject;
57
import org.openide.filesystems.FileObject;
58
import org.openide.util.Pair;
59
59
60
/**
60
/**
61
 * The basic class clients wanting to extend the CSS editor functionality needs
61
 * The basic class clients wanting to extend the CSS editor functionality needs
(-)a/css.editor/src/org/netbeans/modules/css/editor/module/spi/Utilities.java (-3 / +3 lines)
Lines 59-67 Link Here
59
import org.netbeans.modules.css.lib.api.properties.PropertyDefinition;
59
import org.netbeans.modules.css.lib.api.properties.PropertyDefinition;
60
import org.netbeans.modules.parsing.api.Snapshot;
60
import org.netbeans.modules.parsing.api.Snapshot;
61
import org.netbeans.modules.web.common.api.LexerUtils;
61
import org.netbeans.modules.web.common.api.LexerUtils;
62
import org.netbeans.modules.web.common.api.Pair;
63
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileObject;
64
import org.openide.util.NbBundle;
63
import org.openide.util.NbBundle;
64
import org.openide.util.Pair;
65
65
66
/**
66
/**
67
 *
67
 *
Lines 180-187 Link Here
180
180
181
        PropertyCategory category = PropertyCategory.DEFAULT;
181
        PropertyCategory category = PropertyCategory.DEFAULT;
182
        for(Pair<String, String> pair : parseBundle) {
182
        for(Pair<String, String> pair : parseBundle) {
183
            String name = pair.getA();
183
            String name = pair.first();
184
            String value = pair.getB();
184
            String value = pair.second();
185
            
185
            
186
            if(name.startsWith("$")) {
186
            if(name.startsWith("$")) {
187
                //property category
187
                //property category
(-)a/css.lib/manifest.mf (-1 / +1 lines)
Lines 3-6 Link Here
3
OpenIDE-Module: org.netbeans.modules.css.lib/1
3
OpenIDE-Module: org.netbeans.modules.css.lib/1
4
OpenIDE-Module-Layer: org/netbeans/modules/css/lib/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/css/lib/layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/lib/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/lib/Bundle.properties
6
OpenIDE-Module-Specification-Version: 1.54
6
OpenIDE-Module-Specification-Version: 1.55
(-)a/css.lib/nbproject/project.xml (-2 / +2 lines)
Lines 54-60 Link Here
54
                    <build-prerequisite/>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
55
                    <compile-dependency/>
56
                    <run-dependency>
56
                    <run-dependency>
57
                        <specification-version>1.21</specification-version>
57
                        <specification-version>1.46</specification-version>
58
                    </run-dependency>
58
                    </run-dependency>
59
                </dependency>
59
                </dependency>
60
                <dependency>
60
                <dependency>
Lines 70-76 Link Here
70
                    <build-prerequisite/>
70
                    <build-prerequisite/>
71
                    <compile-dependency/>
71
                    <compile-dependency/>
72
                    <run-dependency>
72
                    <run-dependency>
73
                        <specification-version>8.18</specification-version>
73
                        <specification-version>8.32</specification-version>
74
                    </run-dependency>
74
                    </run-dependency>
75
                </dependency>
75
                </dependency>
76
                <dependency>
76
                <dependency>
(-)a/css.lib/src/org/netbeans/modules/css/lib/api/properties/GrammarResolver.java (-4 / +4 lines)
Lines 47-53 Link Here
47
import java.util.logging.Logger;
47
import java.util.logging.Logger;
48
import static org.netbeans.modules.css.lib.api.properties.GrammarResolver.Log.*;
48
import static org.netbeans.modules.css.lib.api.properties.GrammarResolver.Log.*;
49
import org.netbeans.modules.css.lib.properties.GrammarParseTreeBuilder;
49
import org.netbeans.modules.css.lib.properties.GrammarParseTreeBuilder;
50
import org.netbeans.modules.web.common.api.Pair;
50
import org.openide.util.Pair;
51
51
52
/**
52
/**
53
 * Resolves a css property value against its grammar.
53
 * Resolves a css property value against its grammar.
Lines 328-334 Link Here
328
        }
328
        }
329
329
330
        Pair<InputState, Collection<ValueGrammarElement>> pair = resolvedSomething.get(lastResolved);
330
        Pair<InputState, Collection<ValueGrammarElement>> pair = resolvedSomething.get(lastResolved);
331
        pair.getB().add(valueGrammarElement);
331
        pair.second().add(valueGrammarElement);
332
    }
332
    }
333
333
334
    private void groupMemberResolved(GrammarElement member, GroupGrammarElement group, InputState state, boolean root) {
334
    private void groupMemberResolved(GrammarElement member, GroupGrammarElement group, InputState state, boolean root) {
Lines 340-353 Link Here
340
        if (LOG) {
340
        if (LOG) {
341
            log(ALTERNATIVES, String.format("input matched %s, %s", member.path(), state));
341
            log(ALTERNATIVES, String.format("input matched %s, %s", member.path(), state));
342
        }
342
        }
343
        resolvedSomething.put(group, new Pair<InputState, Collection<ValueGrammarElement>>(state, new LinkedList<ValueGrammarElement>()));
343
        resolvedSomething.put(group, Pair.<InputState, Collection<ValueGrammarElement>>of(state, new LinkedList<ValueGrammarElement>()));
344
        lastResolved = group;
344
        lastResolved = group;
345
    }
345
    }
346
346
347
    private Set<ValueGrammarElement> getAlternatives() {
347
    private Set<ValueGrammarElement> getAlternatives() {
348
        HashSet<ValueGrammarElement> alternatives = new HashSet<>();
348
        HashSet<ValueGrammarElement> alternatives = new HashSet<>();
349
        for (Pair<InputState, Collection<ValueGrammarElement>> tri : resolvedSomething.values()) {
349
        for (Pair<InputState, Collection<ValueGrammarElement>> tri : resolvedSomething.values()) {
350
            for (ValueGrammarElement value : tri.getB()) {
350
            for (ValueGrammarElement value : tri.second()) {
351
                alternatives.add(value);
351
                alternatives.add(value);
352
            }
352
            }
353
        }
353
        }
(-)a/css.prep/manifest.mf (-1 / +1 lines)
Lines 3-7 Link Here
3
OpenIDE-Module: org.netbeans.modules.css.prep
3
OpenIDE-Module: org.netbeans.modules.css.prep
4
OpenIDE-Module-Layer: org/netbeans/modules/css/prep/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/css/prep/layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/prep/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/prep/Bundle.properties
6
OpenIDE-Module-Specification-Version: 1.10
6
OpenIDE-Module-Specification-Version: 1.11
7
7
(-)a/css.prep/nbproject/project.xml (-3 / +3 lines)
Lines 47-53 Link Here
47
                    <compile-dependency/>
47
                    <compile-dependency/>
48
                    <run-dependency>
48
                    <run-dependency>
49
                        <release-version>1</release-version>
49
                        <release-version>1</release-version>
50
                        <specification-version>1.49</specification-version>
50
                        <specification-version>1.53</specification-version>
51
                    </run-dependency>
51
                    </run-dependency>
52
                </dependency>
52
                </dependency>
53
                <dependency>
53
                <dependency>
Lines 161-167 Link Here
161
                    <build-prerequisite/>
161
                    <build-prerequisite/>
162
                    <compile-dependency/>
162
                    <compile-dependency/>
163
                    <run-dependency>
163
                    <run-dependency>
164
                        <specification-version>1.45</specification-version>
164
                        <specification-version>1.46</specification-version>
165
                    </run-dependency>
165
                    </run-dependency>
166
                </dependency>
166
                </dependency>
167
                <dependency>
167
                <dependency>
Lines 225-231 Link Here
225
                    <build-prerequisite/>
225
                    <build-prerequisite/>
226
                    <compile-dependency/>
226
                    <compile-dependency/>
227
                    <run-dependency>
227
                    <run-dependency>
228
                        <specification-version>8.30</specification-version>
228
                        <specification-version>8.32</specification-version>
229
                    </run-dependency>
229
                    </run-dependency>
230
                </dependency>
230
                </dependency>
231
                <dependency>
231
                <dependency>
(-)a/css.prep/src/org/netbeans/modules/css/prep/editor/CPCssEditorModule.java (-3 / +3 lines)
Lines 84-93 Link Here
84
import org.netbeans.modules.web.common.api.DependencyType;
84
import org.netbeans.modules.web.common.api.DependencyType;
85
import org.netbeans.modules.web.common.api.LexerUtils;
85
import org.netbeans.modules.web.common.api.LexerUtils;
86
import org.netbeans.modules.web.common.api.Lines;
86
import org.netbeans.modules.web.common.api.Lines;
87
import org.netbeans.modules.web.common.api.Pair;
88
import org.netbeans.modules.web.common.api.WebUtils;
87
import org.netbeans.modules.web.common.api.WebUtils;
89
import org.openide.filesystems.FileObject;
88
import org.openide.filesystems.FileObject;
90
import org.openide.util.Exceptions;
89
import org.openide.util.Exceptions;
90
import org.openide.util.Pair;
91
import org.openide.util.lookup.ServiceProvider;
91
import org.openide.util.lookup.ServiceProvider;
92
92
93
/**
93
/**
Lines 475-481 Link Here
475
                        return DeclarationLocation.NONE;
475
                        return DeclarationLocation.NONE;
476
                    }
476
                    }
477
                };
477
                };
478
                return new Pair<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>>(foundRange, callable);
478
                return Pair.<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>>of(foundRange, callable);
479
479
480
            case SASS_VAR:
480
            case SASS_VAR:
481
            case AT_IDENT: //less var //TODO - add default directives - see the css grammar file comment about that
481
            case AT_IDENT: //less var //TODO - add default directives - see the css grammar file comment about that
Lines 521-527 Link Here
521
                        return DeclarationLocation.NONE;
521
                        return DeclarationLocation.NONE;
522
                    }
522
                    }
523
                };
523
                };
524
                return new Pair<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>>(foundRange, callable);
524
                return Pair.<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>>of(foundRange, callable);
525
525
526
            default:
526
            default:
527
                return null;
527
                return null;
(-)a/css.prep/src/org/netbeans/modules/css/prep/util/ExternalExecutable.java (-4 / +4 lines)
Lines 70-77 Link Here
70
import org.netbeans.api.extexecution.input.InputProcessor;
70
import org.netbeans.api.extexecution.input.InputProcessor;
71
import org.netbeans.api.extexecution.input.InputProcessors;
71
import org.netbeans.api.extexecution.input.InputProcessors;
72
import org.netbeans.api.progress.ProgressUtils;
72
import org.netbeans.api.progress.ProgressUtils;
73
import org.netbeans.modules.web.common.api.Pair;
74
import org.openide.util.NbBundle;
73
import org.openide.util.NbBundle;
74
import org.openide.util.Pair;
75
import org.openide.util.Parameters;
75
import org.openide.util.Parameters;
76
import org.openide.util.Utilities;
76
import org.openide.util.Utilities;
77
import org.openide.windows.InputOutput;
77
import org.openide.windows.InputOutput;
Lines 126-133 Link Here
126
     */
126
     */
127
    public ExternalExecutable(String command) {
127
    public ExternalExecutable(String command) {
128
        Pair<String, List<String>> parsedCommand = parseCommand(command);
128
        Pair<String, List<String>> parsedCommand = parseCommand(command);
129
        executable = parsedCommand.getA();
129
        executable = parsedCommand.first();
130
        parameters = parsedCommand.getB();
130
        parameters = parsedCommand.second();
131
        this.command = command.trim();
131
        this.command = command.trim();
132
    }
132
    }
133
133
Lines 143-149 Link Here
143
            return Pair.of(tokens[0].trim(), Collections.<String>emptyList());
143
            return Pair.of(tokens[0].trim(), Collections.<String>emptyList());
144
        }
144
        }
145
        Pair<String, List<String>> parsedCommand = Pair.of(tokens[0].trim(), Arrays.asList(Utilities.parseParameters(tokens[1].trim())));
145
        Pair<String, List<String>> parsedCommand = Pair.of(tokens[0].trim(), Arrays.asList(Utilities.parseParameters(tokens[1].trim())));
146
        LOGGER.log(Level.FINE, "Parameters parsed: {0} {1}", new Object[] {parsedCommand.getA(), parsedCommand.getB()});
146
        LOGGER.log(Level.FINE, "Parameters parsed: {0} {1}", new Object[] {parsedCommand.first(), parsedCommand.second()});
147
        return parsedCommand;
147
        return parsedCommand;
148
    }
148
    }
149
149
(-)a/css.prep/src/org/netbeans/modules/css/prep/util/ExternalExecutableValidator.java (-1 / +1 lines)
Lines 67-73 Link Here
67
    public static String validateCommand(@NullAllowed String command, @NullAllowed String executableName) {
67
    public static String validateCommand(@NullAllowed String command, @NullAllowed String executableName) {
68
        String executable = null;
68
        String executable = null;
69
        if (command != null) {
69
        if (command != null) {
70
            executable = ExternalExecutable.parseCommand(command).getA();
70
            executable = ExternalExecutable.parseCommand(command).first();
71
        }
71
        }
72
        if (executableName == null) {
72
        if (executableName == null) {
73
            return FileUtils.validateFile(executable, false);
73
            return FileUtils.validateFile(executable, false);
(-)a/debugger.jpda.ui/nbproject/project.xml (-2 / +2 lines)
Lines 64-70 Link Here
64
                    <compile-dependency/>
64
                    <compile-dependency/>
65
                    <run-dependency>
65
                    <run-dependency>
66
                        <release-version>2</release-version>
66
                        <release-version>2</release-version>
67
			<specification-version>2.42</specification-version>
67
                        <specification-version>2.42</specification-version>
68
                    </run-dependency>
68
                    </run-dependency>
69
                </dependency>
69
                </dependency>
70
                <dependency>
70
                <dependency>
Lines 277-283 Link Here
277
                    <build-prerequisite/>
277
                    <build-prerequisite/>
278
                    <compile-dependency/>
278
                    <compile-dependency/>
279
                    <run-dependency>
279
                    <run-dependency>
280
                        <specification-version>8.0</specification-version>
280
                        <specification-version>8.32</specification-version>
281
                    </run-dependency>
281
                    </run-dependency>
282
                </dependency>
282
                </dependency>
283
                <dependency>
283
                <dependency>
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/ClassBreakpointPanel.java (-3 / +4 lines)
Lines 62-67 Link Here
62
import org.openide.NotifyDescriptor;
62
import org.openide.NotifyDescriptor;
63
import org.openide.util.HelpCtx;
63
import org.openide.util.HelpCtx;
64
import org.openide.util.NbBundle;
64
import org.openide.util.NbBundle;
65
import org.openide.util.Pair;
65
66
66
/**
67
/**
67
 * @author  Jan Jancura
68
 * @author  Jan Jancura
Lines 119-126 Link Here
119
        ResourceBundle bundle = NbBundle.getBundle(ClassBreakpointPanel.class);
120
        ResourceBundle bundle = NbBundle.getBundle(ClassBreakpointPanel.class);
120
        String tooltipText = bundle.getString("TTT_TF_Class_Breakpoint_Class_Name");
121
        String tooltipText = bundle.getString("TTT_TF_Class_Breakpoint_Class_Name");
121
        Pair<JScrollPane, JEditorPane> editorCC = addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
122
        Pair<JScrollPane, JEditorPane> editorCC = addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
122
        spClassName = editorCC.get1();
123
        spClassName = editorCC.first();
123
        epClassName = editorCC.get2();
124
        epClassName = editorCC.second();
124
        epClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
125
        epClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
125
        epClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Class_Breakpoint_ClassName"));
126
        epClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Class_Breakpoint_ClassName"));
126
        HelpCtx.setHelpIDString(epClassName, HELP_ID);
127
        HelpCtx.setHelpIDString(epClassName, HELP_ID);
Lines 347-353 Link Here
347
        }
348
        }
348
        sle.setToolTipText(tooltipText);
349
        sle.setToolTipText(tooltipText);
349
        epClassName.setToolTipText(tooltipText);
350
        epClassName.setToolTipText(tooltipText);
350
        return new Pair(sle, epClassName);
351
        return Pair.<JScrollPane, JEditorPane>of(sle, epClassName);
351
    }
352
    }
352
    
353
    
353
    // Variables declaration - do not modify//GEN-BEGIN:variables
354
    // Variables declaration - do not modify//GEN-BEGIN:variables
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/ExceptionBreakpointPanel.java (-2 / +3 lines)
Lines 59-64 Link Here
59
import org.openide.NotifyDescriptor;
59
import org.openide.NotifyDescriptor;
60
import org.openide.util.HelpCtx;
60
import org.openide.util.HelpCtx;
61
import org.openide.util.NbBundle;
61
import org.openide.util.NbBundle;
62
import org.openide.util.Pair;
62
63
63
64
64
/**
65
/**
Lines 114-121 Link Here
114
        String tooltipText = bundle.getString("TTT_TF_Field_Breakpoint_Class_Name");
115
        String tooltipText = bundle.getString("TTT_TF_Field_Breakpoint_Class_Name");
115
        Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(
116
        Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(
116
                ExceptionClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
117
                ExceptionClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
117
        spExceptionClassName = editorCC.get1();
118
        spExceptionClassName = editorCC.first();
118
        epExceptionClassName = editorCC.get2();
119
        epExceptionClassName = editorCC.second();
119
        epExceptionClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
120
        epExceptionClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
120
        epExceptionClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Exception_Breakpoint_ClassName"));
121
        epExceptionClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Exception_Breakpoint_ClassName"));
121
        HelpCtx.setHelpIDString(epExceptionClassName, HELP_ID);
122
        HelpCtx.setHelpIDString(epExceptionClassName, HELP_ID);
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/FieldBreakpointPanel.java (-4 / +5 lines)
Lines 62-67 Link Here
62
import org.openide.NotifyDescriptor;
62
import org.openide.NotifyDescriptor;
63
import org.openide.util.HelpCtx;
63
import org.openide.util.HelpCtx;
64
import org.openide.util.NbBundle;
64
import org.openide.util.NbBundle;
65
import org.openide.util.Pair;
65
66
66
/**
67
/**
67
 * @author  Jan Jancura
68
 * @author  Jan Jancura
Lines 124-139 Link Here
124
        ResourceBundle bundle = NbBundle.getBundle(FieldBreakpointPanel.class);
125
        ResourceBundle bundle = NbBundle.getBundle(FieldBreakpointPanel.class);
125
        String tooltipText = bundle.getString("TTT_TF_Field_Breakpoint_Class_Name");
126
        String tooltipText = bundle.getString("TTT_TF_Field_Breakpoint_Class_Name");
126
        Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
127
        Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
127
        spClassName = editorCC.get1();
128
        spClassName = editorCC.first();
128
        epClassName = editorCC.get2();
129
        epClassName = editorCC.second();
129
        epClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
130
        epClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
130
        epClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Field_Breakpoint_ClassName"));
131
        epClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Field_Breakpoint_ClassName"));
131
        HelpCtx.setHelpIDString(epClassName, HELP_ID);
132
        HelpCtx.setHelpIDString(epClassName, HELP_ID);
132
        jLabel3.setLabelFor(spClassName);
133
        jLabel3.setLabelFor(spClassName);
133
        
134
        
134
        editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaFieldNbDebugEditorKit.MIME_TYPE, null, b.getFieldName(), bundle.getString("TTT_TF_Field_Breakpoint_Field_Name"));
135
        editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaFieldNbDebugEditorKit.MIME_TYPE, null, b.getFieldName(), bundle.getString("TTT_TF_Field_Breakpoint_Field_Name"));
135
        spFieldName = editorCC.get1();
136
        spFieldName = editorCC.first();
136
        epFieldName = editorCC.get2();
137
        epFieldName = editorCC.second();
137
        
138
        
138
        jLabel1.setLabelFor(spFieldName);
139
        jLabel1.setLabelFor(spFieldName);
139
        java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
140
        java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/MethodBreakpointPanel.java (-4 / +5 lines)
Lines 60-65 Link Here
60
import org.openide.ErrorManager;
60
import org.openide.ErrorManager;
61
import org.openide.util.HelpCtx;
61
import org.openide.util.HelpCtx;
62
import org.openide.util.NbBundle;
62
import org.openide.util.NbBundle;
63
import org.openide.util.Pair;
63
64
64
/**
65
/**
65
 * @author  Jan Jancura
66
 * @author  Jan Jancura
Lines 126-133 Link Here
126
        className = ClassBreakpointPanel.concatClassFilters(cf);
127
        className = ClassBreakpointPanel.concatClassFilters(cf);
127
        String tooltipText = NbBundle.getMessage(MethodBreakpointPanel.class, "TTT_TF_Field_Breakpoint_Class_Name");
128
        String tooltipText = NbBundle.getMessage(MethodBreakpointPanel.class, "TTT_TF_Field_Breakpoint_Class_Name");
128
        Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, null, className, tooltipText);
129
        Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, null, className, tooltipText);
129
        spClassName = editorCC.get1();
130
        spClassName = editorCC.first();
130
        epClassName = editorCC.get2();
131
        epClassName = editorCC.second();
131
        epClassName.getAccessibleContext().setAccessibleName(NbBundle.getMessage(MethodBreakpointPanel.class, "ACSN_Method_Breakpoint_ClassName"));
132
        epClassName.getAccessibleContext().setAccessibleName(NbBundle.getMessage(MethodBreakpointPanel.class, "ACSN_Method_Breakpoint_ClassName"));
132
        epClassName.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(MethodBreakpointPanel.class, "ACSD_Method_Breakpoint_ClassName"));
133
        epClassName.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(MethodBreakpointPanel.class, "ACSD_Method_Breakpoint_ClassName"));
133
        jLabel3.setLabelFor(spClassName);
134
        jLabel3.setLabelFor(spClassName);
Lines 135-142 Link Here
135
        panelClassName.add(java.awt.BorderLayout.CENTER, spClassName);
136
        panelClassName.add(java.awt.BorderLayout.CENTER, spClassName);
136
        
137
        
137
        editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaMethodNbDebugEditorKit.MIME_TYPE, null, className, org.openide.util.NbBundle.getMessage(MethodBreakpointPanel.class, "TTT_TF_Method_Breakpoint_Method_Name"));
138
        editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaMethodNbDebugEditorKit.MIME_TYPE, null, className, org.openide.util.NbBundle.getMessage(MethodBreakpointPanel.class, "TTT_TF_Method_Breakpoint_Method_Name"));
138
        spMethodName = editorCC.get1();
139
        spMethodName = editorCC.first();
139
        epMethodName = editorCC.get2();
140
        epMethodName = editorCC.second();
140
        jLabel1.setLabelFor(spMethodName);
141
        jLabel1.setLabelFor(spMethodName);
141
        java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
142
        java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
142
        gridBagConstraints.gridx = 1;
143
        gridBagConstraints.gridx = 1;
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/Pair.java (-67 lines)
Lines 1-67 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.debugger.jpda.ui.breakpoints;
43
44
/**
45
 * A pair of values
46
 * 
47
 * @author Martin Entlicher
48
 */
49
final class Pair<T1, T2> {
50
        
51
    private final T1 o1;
52
    private final T2 o2;
53
54
    public Pair(final T1 o1, final T2 o2) {
55
        this.o1 = o1;
56
        this.o2 = o2;
57
    }
58
59
    public T1 get1() {
60
        return o1;
61
    }
62
63
    public T2 get2() {
64
        return o2;
65
    }
66
67
}
(-)a/html.editor/manifest.mf (-1 / +1 lines)
Lines 2-6 Link Here
2
OpenIDE-Module: org.netbeans.modules.html.editor/2
2
OpenIDE-Module: org.netbeans.modules.html.editor/2
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/html/editor/resources/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/html/editor/resources/Bundle.properties
4
OpenIDE-Module-Layer: org/netbeans/modules/html/editor/resources/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/html/editor/resources/layer.xml
5
OpenIDE-Module-Specification-Version: 2.19
5
OpenIDE-Module-Specification-Version: 2.20
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
(-)a/html.editor/nbproject/project.xml (-2 / +2 lines)
Lines 276-282 Link Here
276
                    <build-prerequisite/>
276
                    <build-prerequisite/>
277
                    <compile-dependency/>
277
                    <compile-dependency/>
278
                    <run-dependency>
278
                    <run-dependency>
279
                        <specification-version>1.12</specification-version>
279
                        <specification-version>1.46</specification-version>
280
                    </run-dependency>
280
                    </run-dependency>
281
                </dependency>
281
                </dependency>
282
                <dependency>
282
                <dependency>
Lines 365-371 Link Here
365
                    <build-prerequisite/>
365
                    <build-prerequisite/>
366
                    <compile-dependency/>
366
                    <compile-dependency/>
367
                    <run-dependency>
367
                    <run-dependency>
368
                        <specification-version>8.0</specification-version>
368
                        <specification-version>8.32</specification-version>
369
                    </run-dependency>
369
                    </run-dependency>
370
                </dependency>
370
                </dependency>
371
                <dependency>
371
                <dependency>
(-)a/html.editor/src/org/netbeans/modules/html/editor/gsf/HtmlStructureScanner.java (-6 / +6 lines)
Lines 57-66 Link Here
57
import org.netbeans.modules.html.editor.api.gsf.HtmlParserResult;
57
import org.netbeans.modules.html.editor.api.gsf.HtmlParserResult;
58
import org.netbeans.modules.html.editor.lib.api.elements.*;
58
import org.netbeans.modules.html.editor.lib.api.elements.*;
59
import org.netbeans.modules.parsing.api.Snapshot;
59
import org.netbeans.modules.parsing.api.Snapshot;
60
import org.netbeans.modules.web.common.api.Pair;
61
import org.openide.filesystems.FileObject;
60
import org.openide.filesystems.FileObject;
62
import org.openide.util.NbBundle;
61
import org.openide.util.NbBundle;
63
import static org.netbeans.modules.html.editor.gsf.Bundle.*;
62
import static org.netbeans.modules.html.editor.gsf.Bundle.*;
63
import org.openide.util.Pair;
64
64
65
/**
65
/**
66
 *
66
 *
Lines 99-106 Link Here
99
        if (cache != null) {
99
        if (cache != null) {
100
            Pair<ParserResult, List<HtmlStructureItem>> pair = cache.get();
100
            Pair<ParserResult, List<HtmlStructureItem>> pair = cache.get();
101
            if (pair != null) {
101
            if (pair != null) {
102
                if (info == pair.getA()) {
102
                if (info == pair.first()) {
103
                    return pair.getB();
103
                    return pair.second();
104
                }
104
                }
105
            }
105
            }
106
        }
106
        }
Lines 119-133 Link Here
119
119
120
        Snapshot snapshot = info.getSnapshot();
120
        Snapshot snapshot = info.getSnapshot();
121
        FileObject file = snapshot.getSource().getFileObject();
121
        FileObject file = snapshot.getSource().getFileObject();
122
        List<StructureItem> elements = new ArrayList<StructureItem>();
122
        List<HtmlStructureItem> elements = new ArrayList<HtmlStructureItem>();
123
        for(OpenTag tag : root.children(OpenTag.class)) {
123
        for(OpenTag tag : root.children(OpenTag.class)) {
124
            HtmlElementHandle handle = new HtmlElementHandle(tag, file);
124
            HtmlElementHandle handle = new HtmlElementHandle(tag, file);
125
            StructureItem si = new HtmlStructureItem(tag, handle, snapshot);
125
            HtmlStructureItem si = new HtmlStructureItem(tag, handle, snapshot);
126
            elements.add(si);
126
            elements.add(si);
127
        }
127
        }
128
128
129
        //cache
129
        //cache
130
        Pair<ParserResult, List<HtmlStructureItem>> pair = new Pair(info, elements);
130
        Pair<ParserResult, List<HtmlStructureItem>> pair = Pair.of(info, elements);
131
        cache = new WeakReference<Pair<ParserResult, List<HtmlStructureItem>>>(pair);
131
        cache = new WeakReference<Pair<ParserResult, List<HtmlStructureItem>>>(pair);
132
132
133
        return elements;
133
        return elements;
(-)a/java.hints/nbproject/project.xml (-1 / +1 lines)
Lines 425-431 Link Here
425
                    <build-prerequisite/>
425
                    <build-prerequisite/>
426
                    <compile-dependency/>
426
                    <compile-dependency/>
427
                    <run-dependency>
427
                    <run-dependency>
428
                        <specification-version>8.10</specification-version>
428
                        <specification-version>8.32</specification-version>
429
                    </run-dependency>
429
                    </run-dependency>
430
                </dependency>
430
                </dependency>
431
                <dependency>
431
                <dependency>
(-)a/java.hints/src/org/netbeans/modules/java/hints/ConvertAnonymousToInner.java (-3 / +3 lines)
Lines 83-89 Link Here
83
import org.netbeans.api.java.source.support.SelectionAwareJavaSourceTaskFactory;
83
import org.netbeans.api.java.source.support.SelectionAwareJavaSourceTaskFactory;
84
import org.netbeans.modules.java.editor.rename.InstantRenamePerformer;
84
import org.netbeans.modules.java.editor.rename.InstantRenamePerformer;
85
import org.netbeans.modules.java.hints.errors.Utilities;
85
import org.netbeans.modules.java.hints.errors.Utilities;
86
import org.netbeans.modules.java.hints.infrastructure.Pair;
87
import org.netbeans.modules.java.hints.spi.AbstractHint;
86
import org.netbeans.modules.java.hints.spi.AbstractHint;
88
import org.netbeans.spi.editor.hints.ChangeInfo;
87
import org.netbeans.spi.editor.hints.ChangeInfo;
89
import org.netbeans.spi.editor.hints.ErrorDescription;
88
import org.netbeans.spi.editor.hints.ErrorDescription;
Lines 96-101 Link Here
96
import org.openide.loaders.DataObjectNotFoundException;
95
import org.openide.loaders.DataObjectNotFoundException;
97
import org.openide.util.Exceptions;
96
import org.openide.util.Exceptions;
98
import org.openide.util.NbBundle;
97
import org.openide.util.NbBundle;
98
import org.openide.util.Pair;
99
99
100
/**
100
/**
101
 *
101
 *
Lines 491-498 Link Here
491
	    if (resolvedArguments != null) {
491
	    if (resolvedArguments != null) {
492
		nueSuperConstructorCallRealArguments = new LinkedList<ExpressionTree>();
492
		nueSuperConstructorCallRealArguments = new LinkedList<ExpressionTree>();
493
493
494
		Iterator<? extends TypeMirror> typeIt   = resolvedArguments.getA().iterator();
494
		Iterator<? extends TypeMirror> typeIt   = resolvedArguments.first().iterator();
495
		Iterator<String>               nameIt   = resolvedArguments.getB().iterator();
495
		Iterator<String>               nameIt   = resolvedArguments.second().iterator();
496
496
497
		while (typeIt.hasNext() && nameIt.hasNext()) {
497
		while (typeIt.hasNext() && nameIt.hasNext()) {
498
		    TypeMirror tm = typeIt.next();
498
		    TypeMirror tm = typeIt.next();
(-)a/java.hints/src/org/netbeans/modules/java/hints/bugs/UnusedAssignmentOrBranch.java (-4 / +4 lines)
Lines 57-63 Link Here
57
import org.netbeans.api.java.source.CompilationInfo;
57
import org.netbeans.api.java.source.CompilationInfo;
58
import org.netbeans.api.java.source.CompilationInfo.CacheClearPolicy;
58
import org.netbeans.api.java.source.CompilationInfo.CacheClearPolicy;
59
import org.netbeans.api.java.source.support.CancellableTreePathScanner;
59
import org.netbeans.api.java.source.support.CancellableTreePathScanner;
60
import org.netbeans.modules.java.hints.infrastructure.Pair;
61
import org.netbeans.modules.java.hints.introduce.Flow;
60
import org.netbeans.modules.java.hints.introduce.Flow;
62
import org.netbeans.modules.java.hints.introduce.Flow.FlowResult;
61
import org.netbeans.modules.java.hints.introduce.Flow.FlowResult;
63
import org.netbeans.spi.java.hints.Hint;
62
import org.netbeans.spi.java.hints.Hint;
Lines 69-74 Link Here
69
import org.netbeans.spi.java.hints.TriggerPattern;
68
import org.netbeans.spi.java.hints.TriggerPattern;
70
import org.netbeans.spi.java.hints.TriggerPatterns;
69
import org.netbeans.spi.java.hints.TriggerPatterns;
71
import org.openide.util.NbBundle;
70
import org.openide.util.NbBundle;
71
import org.openide.util.Pair;
72
72
73
/**
73
/**
74
 *
74
 *
Lines 136-142 Link Here
136
            }
136
            }
137
        }.scan(info.getCompilationUnit(), null);
137
        }.scan(info.getCompilationUnit(), null);
138
138
139
        info.putCachedValue(KEY_COMPUTED_ASSIGNMENTS, result = new Pair<Set<Tree>, Set<Element>>(usedAssignments, usedVariables), CacheClearPolicy.ON_TASK_END);
139
        info.putCachedValue(KEY_COMPUTED_ASSIGNMENTS, result = Pair.<Set<Tree>, Set<Element>>of(usedAssignments, usedVariables), CacheClearPolicy.ON_TASK_END);
140
140
141
        return result;
141
        return result;
142
    }
142
    }
Lines 155-162 Link Here
155
        if (ctx.isCanceled() || computedAssignments == null) return null;
155
        if (ctx.isCanceled() || computedAssignments == null) return null;
156
156
157
        final CompilationInfo info = ctx.getInfo();
157
        final CompilationInfo info = ctx.getInfo();
158
        final Set<Tree> usedAssignments = computedAssignments.getA();
158
        final Set<Tree> usedAssignments = computedAssignments.first();
159
        final Set<Element> usedVariables = computedAssignments.getB();
159
        final Set<Element> usedVariables = computedAssignments.second();
160
        Element var = info.getTrees().getElement(ctx.getVariables().get("$var"));
160
        Element var = info.getTrees().getElement(ctx.getVariables().get("$var"));
161
        Tree value = ctx.getVariables().get("$value").getLeaf();
161
        Tree value = ctx.getVariables().get("$value").getLeaf();
162
162
(-)a/java.hints/src/org/netbeans/modules/java/hints/errors/ChangeMethodParameters.java (-1 / +1 lines)
Lines 52-58 Link Here
52
import org.netbeans.api.java.source.TreePathHandle;
52
import org.netbeans.api.java.source.TreePathHandle;
53
import org.netbeans.api.java.source.TreeUtilities;
53
import org.netbeans.api.java.source.TreeUtilities;
54
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider;
54
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider;
55
import org.netbeans.modules.java.hints.infrastructure.Pair;
56
import org.netbeans.modules.java.hints.spi.ErrorRule;
55
import org.netbeans.modules.java.hints.spi.ErrorRule;
57
import org.netbeans.modules.java.hints.spi.ErrorRule.Data;
56
import org.netbeans.modules.java.hints.spi.ErrorRule.Data;
58
import org.netbeans.modules.refactoring.java.api.ChangeParametersRefactoring;
57
import org.netbeans.modules.refactoring.java.api.ChangeParametersRefactoring;
Lines 60-65 Link Here
60
import org.netbeans.spi.editor.hints.Fix;
59
import org.netbeans.spi.editor.hints.Fix;
61
import org.openide.util.Exceptions;
60
import org.openide.util.Exceptions;
62
import org.openide.util.NbBundle;
61
import org.openide.util.NbBundle;
62
import org.openide.util.Pair;
63
63
64
64
65
public class ChangeMethodParameters implements ErrorRule<Void> {
65
public class ChangeMethodParameters implements ErrorRule<Void> {
(-)a/java.hints/src/org/netbeans/modules/java/hints/errors/CreateElement.java (-5 / +5 lines)
Lines 85-91 Link Here
85
import org.netbeans.modules.java.hints.errors.CreateClassFix.CreateInnerClassFix;
85
import org.netbeans.modules.java.hints.errors.CreateClassFix.CreateInnerClassFix;
86
import org.netbeans.modules.java.hints.errors.CreateClassFix.CreateOuterClassFix;
86
import org.netbeans.modules.java.hints.errors.CreateClassFix.CreateOuterClassFix;
87
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider;
87
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider;
88
import org.netbeans.modules.java.hints.infrastructure.Pair;
89
import org.netbeans.modules.java.hints.spi.ErrorRule;
88
import org.netbeans.modules.java.hints.spi.ErrorRule;
90
import org.netbeans.spi.editor.hints.Fix;
89
import org.netbeans.spi.editor.hints.Fix;
91
import org.openide.ErrorManager;
90
import org.openide.ErrorManager;
Lines 96-101 Link Here
96
import static org.netbeans.modules.java.hints.errors.CreateElementUtilities.*;
95
import static org.netbeans.modules.java.hints.errors.CreateElementUtilities.*;
97
import org.netbeans.modules.java.hints.errors.ErrorFixesFakeHint.FixKind;
96
import org.netbeans.modules.java.hints.errors.ErrorFixesFakeHint.FixKind;
98
import org.netbeans.modules.java.hints.errors.Utilities.MethodArguments;
97
import org.netbeans.modules.java.hints.errors.Utilities.MethodArguments;
98
import org.openide.util.Pair;
99
99
100
/**
100
/**
101
 *
101
 *
Lines 449-455 Link Here
449
    }
449
    }
450
450
451
    private static List<Fix> prepareCreateOuterClassFix(CompilationInfo info, TreePath invocation, Element source, Set<Modifier> modifiers, String simpleName, List<? extends ExpressionTree> realArguments, TypeMirror superType, ElementKind kind, int numTypeParameters) {
451
    private static List<Fix> prepareCreateOuterClassFix(CompilationInfo info, TreePath invocation, Element source, Set<Modifier> modifiers, String simpleName, List<? extends ExpressionTree> realArguments, TypeMirror superType, ElementKind kind, int numTypeParameters) {
452
        Pair<List<? extends TypeMirror>, List<String>> formalArguments = invocation != null ? Utilities.resolveArguments(info, invocation, realArguments, null) : new Pair<List<? extends TypeMirror>, List<String>>(null, null);
452
        Pair<List<? extends TypeMirror>, List<String>> formalArguments = invocation != null ? Utilities.resolveArguments(info, invocation, realArguments, null) : Pair.<List<? extends TypeMirror>, List<String>>of(null, null);
453
453
454
        if (formalArguments == null) {
454
        if (formalArguments == null) {
455
            return Collections.<Fix>emptyList();
455
            return Collections.<Fix>emptyList();
Lines 464-474 Link Here
464
464
465
        PackageElement packageElement = (PackageElement) (source instanceof PackageElement ? source : info.getElementUtilities().outermostTypeElement(source).getEnclosingElement());
465
        PackageElement packageElement = (PackageElement) (source instanceof PackageElement ? source : info.getElementUtilities().outermostTypeElement(source).getEnclosingElement());
466
466
467
        return Collections.<Fix>singletonList(new CreateOuterClassFix(info, root, packageElement.getQualifiedName().toString(), simpleName, modifiers, formalArguments.getA(), formalArguments.getB(), superType, kind, numTypeParameters));
467
        return Collections.<Fix>singletonList(new CreateOuterClassFix(info, root, packageElement.getQualifiedName().toString(), simpleName, modifiers, formalArguments.first(), formalArguments.second(), superType, kind, numTypeParameters));
468
    }
468
    }
469
469
470
    private static List<Fix> prepareCreateInnerClassFix(CompilationInfo info, TreePath invocation, TypeElement target, Set<Modifier> modifiers, String simpleName, List<? extends ExpressionTree> realArguments, TypeMirror superType, ElementKind kind, int numTypeParameters) {
470
    private static List<Fix> prepareCreateInnerClassFix(CompilationInfo info, TreePath invocation, TypeElement target, Set<Modifier> modifiers, String simpleName, List<? extends ExpressionTree> realArguments, TypeMirror superType, ElementKind kind, int numTypeParameters) {
471
        Pair<List<? extends TypeMirror>, List<String>> formalArguments = invocation != null ? Utilities.resolveArguments(info, invocation, realArguments, target) : new Pair<List<? extends TypeMirror>, List<String>>(null, null);
471
        Pair<List<? extends TypeMirror>, List<String>> formalArguments = invocation != null ? Utilities.resolveArguments(info, invocation, realArguments, target) : Pair.<List<? extends TypeMirror>, List<String>>of(null, null);
472
472
473
        if (formalArguments == null) {
473
        if (formalArguments == null) {
474
            return Collections.<Fix>emptyList();
474
            return Collections.<Fix>emptyList();
Lines 483-489 Link Here
483
        if (targetFile == null)
483
        if (targetFile == null)
484
            return Collections.<Fix>emptyList();
484
            return Collections.<Fix>emptyList();
485
485
486
        return Collections.<Fix>singletonList(new CreateInnerClassFix(info, simpleName, modifiers, target, formalArguments.getA(), formalArguments.getB(), superType, kind, numTypeParameters, targetFile));
486
        return Collections.<Fix>singletonList(new CreateInnerClassFix(info, simpleName, modifiers, target, formalArguments.first(), formalArguments.second(), superType, kind, numTypeParameters, targetFile));
487
    }
487
    }
488
488
489
    private static ElementKind getClassType(Set<ElementKind> types) {
489
    private static ElementKind getClassType(Set<ElementKind> types) {
(-)a/java.hints/src/org/netbeans/modules/java/hints/errors/ImportClass.java (-9 / +9 lines)
Lines 85-91 Link Here
85
import org.netbeans.modules.java.hints.errors.ImportClass.ImportCandidatesHolder;
85
import org.netbeans.modules.java.hints.errors.ImportClass.ImportCandidatesHolder;
86
import org.netbeans.modules.java.hints.infrastructure.CreatorBasedLazyFixList;
86
import org.netbeans.modules.java.hints.infrastructure.CreatorBasedLazyFixList;
87
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider;
87
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider;
88
import org.netbeans.modules.java.hints.infrastructure.Pair;
89
import org.netbeans.modules.java.hints.spi.ErrorRule;
88
import org.netbeans.modules.java.hints.spi.ErrorRule;
90
import org.netbeans.modules.java.preprocessorbridge.spi.ImportProcessor;
89
import org.netbeans.modules.java.preprocessorbridge.spi.ImportProcessor;
91
import org.netbeans.spi.editor.hints.ChangeInfo;
90
import org.netbeans.spi.editor.hints.ChangeInfo;
Lines 100-105 Link Here
100
import org.openide.util.Lookup;
99
import org.openide.util.Lookup;
101
import org.openide.util.NbBundle;
100
import org.openide.util.NbBundle;
102
import org.openide.util.NbBundle.Messages;
101
import org.openide.util.NbBundle.Messages;
102
import org.openide.util.Pair;
103
import org.openide.util.RequestProcessor;
103
import org.openide.util.RequestProcessor;
104
104
105
105
Lines 160-166 Link Here
160
            Element el = info.getTrees().getElement(new TreePath(new TreePath(new TreePath(info.getCompilationUnit()), it), it.getQualifiedIdentifier()));
160
            Element el = info.getTrees().getElement(new TreePath(new TreePath(new TreePath(info.getCompilationUnit()), it), it.getQualifiedIdentifier()));
161
161
162
            if (candidates != null && el != null) {
162
            if (candidates != null && el != null) {
163
                List<Element> a = candidates.getA();
163
                List<Element> a = candidates.first();
164
                if (a != null && a.contains(el)) {
164
                if (a != null && a.contains(el)) {
165
                    return Collections.<Fix>emptyList();
165
                    return Collections.<Fix>emptyList();
166
                }
166
                }
Lines 179-186 Link Here
179
            imp = imp.getParentPath();
179
            imp = imp.getParentPath();
180
        }
180
        }
181
181
182
        List<Element> filtered = candidates.getA();
182
        List<Element> filtered = candidates.first();
183
        List<Element> unfiltered = candidates.getB();
183
        List<Element> unfiltered = candidates.second();
184
        List<Fix> fixes = new ArrayList<Fix>();
184
        List<Fix> fixes = new ArrayList<Fix>();
185
        
185
        
186
        if (unfiltered != null && filtered != null) {
186
        if (unfiltered != null && filtered != null) {
Lines 264-270 Link Here
264
        
264
        
265
        Pair<Map<String, List<Element>>, Map<String, List<Element>>> result = holder.getCandidates();
265
        Pair<Map<String, List<Element>>, Map<String, List<Element>>> result = holder.getCandidates();
266
        
266
        
267
        if (result == null || result.getA() == null || result.getB() == null) {
267
        if (result == null || result.first() == null || result.second() == null) {
268
            //compute imports:
268
            //compute imports:
269
            Map<String, List<String>> candidates = new HashMap<String, List<String>>();
269
            Map<String, List<String>> candidates = new HashMap<String, List<String>>();
270
            ComputeImports imp = new ComputeImports();
270
            ComputeImports imp = new ComputeImports();
Lines 303-317 Link Here
303
                notFilteredCandidates.put(sn, c);
303
                notFilteredCandidates.put(sn, c);
304
            }
304
            }
305
            
305
            
306
            result = new Pair<Map<String, List<Element>>, Map<String, List<Element>>>(rawCandidates.a, rawCandidates.b);
306
            result = Pair.<Map<String, List<Element>>, Map<String, List<Element>>>of(rawCandidates.a, rawCandidates.b);
307
            
307
            
308
            holder.setCandidates(result);
308
            holder.setCandidates(result);
309
        }
309
        }
310
        
310
        
311
        List<Element> candList = result.getA().get(simpleName);
311
        List<Element> candList = result.first().get(simpleName);
312
        List<Element> notFilteredCandList = result.getB().get(simpleName);
312
        List<Element> notFilteredCandList = result.second().get(simpleName);
313
        
313
        
314
        return new Pair(candList, notFilteredCandList);
314
        return Pair.<List<Element>, List<Element>>of(candList, notFilteredCandList);
315
    }
315
    }
316
    
316
    
317
    public static class ImportCandidatesHolder {
317
    public static class ImportCandidatesHolder {
(-)a/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java (-2 / +2 lines)
Lines 59-65 Link Here
59
import org.netbeans.api.java.source.TreeUtilities;
59
import org.netbeans.api.java.source.TreeUtilities;
60
import org.openide.filesystems.FileUtil;
60
import org.openide.filesystems.FileUtil;
61
import org.openide.util.NbBundle;
61
import org.openide.util.NbBundle;
62
import org.netbeans.modules.java.hints.infrastructure.Pair;
63
import com.sun.source.tree.ArrayAccessTree;
62
import com.sun.source.tree.ArrayAccessTree;
64
import com.sun.source.tree.ArrayTypeTree;
63
import com.sun.source.tree.ArrayTypeTree;
65
import com.sun.source.tree.BinaryTree;
64
import com.sun.source.tree.BinaryTree;
Lines 138-143 Link Here
138
import org.openide.util.Exceptions;
137
import org.openide.util.Exceptions;
139
138
140
import static com.sun.source.tree.Tree.Kind.*;
139
import static com.sun.source.tree.Tree.Kind.*;
140
import org.openide.util.Pair;
141
141
142
/**
142
/**
143
 *
143
 *
Lines 880-886 Link Here
880
        
880
        
881
        if (ma == null) return null;
881
        if (ma == null) return null;
882
        
882
        
883
        return new Pair<List<? extends TypeMirror>, List<String>>(ma.parameterTypes, ma.parameterNames);
883
        return Pair.<List<? extends TypeMirror>, List<String>>of(ma.parameterTypes, ma.parameterNames);
884
    }
884
    }
885
    
885
    
886
    public static MethodArguments resolveArguments(CompilationInfo info, TreePath invocation, List<? extends ExpressionTree> realArguments, Element target, TypeMirror returnType) {
886
    public static MethodArguments resolveArguments(CompilationInfo info, TreePath invocation, List<? extends ExpressionTree> realArguments, Element target, TypeMirror returnType) {
(-)a/java.hints/src/org/netbeans/modules/java/hints/infrastructure/Pair.java (-73 lines)
Lines 1-73 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
45
package org.netbeans.modules.java.hints.infrastructure;
46
47
/**
48
 *
49
 * @author Jan Lahoda
50
 */
51
public final class Pair<A, B> {
52
53
    private A a;
54
    private B b;
55
56
    public Pair(A a, B b) {
57
        this.a = a;
58
        this.b = b;
59
    }
60
61
    public A getA() {
62
        return a;
63
    }
64
65
    public B getB() {
66
        return b;
67
    }
68
    
69
     @Override
70
     public String toString() {
71
         return "[" + String.valueOf(a) + "/" + String.valueOf(b) + "]";
72
     }
73
}
(-)a/java.hints/src/org/netbeans/modules/java/hints/jackpot/hintsimpl/ForbiddenMethod.java (-4 / +4 lines)
Lines 55-62 Link Here
55
import org.netbeans.spi.java.hints.TriggerTreeKind;
55
import org.netbeans.spi.java.hints.TriggerTreeKind;
56
import org.netbeans.spi.java.hints.HintContext;
56
import org.netbeans.spi.java.hints.HintContext;
57
import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
57
import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
58
import org.netbeans.modules.java.hints.infrastructure.Pair;
59
import org.netbeans.spi.editor.hints.ErrorDescription;
58
import org.netbeans.spi.editor.hints.ErrorDescription;
59
import org.openide.util.Pair;
60
60
61
/**
61
/**
62
 *
62
 *
Lines 69-75 Link Here
69
69
70
    static {
70
    static {
71
        map = new HashMap<String, Pair<String, String>>();
71
        map = new HashMap<String, Pair<String, String>>();
72
        map.put("exit", new Pair<String, String>("System", "Non-portable"));
72
        map.put("exit", Pair.<String, String>of("System", "Non-portable"));
73
    }
73
    }
74
74
75
    @TriggerTreeKind(Tree.Kind.METHOD_INVOCATION)
75
    @TriggerTreeKind(Tree.Kind.METHOD_INVOCATION)
Lines 86-93 Link Here
86
        String parent = e.getEnclosingElement().getSimpleName().toString();
86
        String parent = e.getEnclosingElement().getSimpleName().toString();
87
87
88
        Pair<String, String> pair = map.get(simpleName);
88
        Pair<String, String> pair = map.get(simpleName);
89
        if (pair != null && pair.getA().equals(parent)) {
89
        if (pair != null && pair.first().equals(parent)) {
90
            return ErrorDescriptionFactory.forName(ctx, mit, pair.getB());
90
            return ErrorDescriptionFactory.forName(ctx, mit, pair.second());
91
        }
91
        }
92
92
93
93
(-)a/java.j2seprofiles/nbproject/project.xml (-1 / +1 lines)
Lines 139-145 Link Here
139
                    <build-prerequisite/>
139
                    <build-prerequisite/>
140
                    <compile-dependency/>
140
                    <compile-dependency/>
141
                    <run-dependency>
141
                    <run-dependency>
142
                        <specification-version>8.31</specification-version>
142
                        <specification-version>8.32</specification-version>
143
                    </run-dependency>
143
                    </run-dependency>
144
                </dependency>
144
                </dependency>
145
                <dependency>
145
                <dependency>
(-)a/java.j2seprofiles/src/org/netbeans/modules/java/j2seprofiles/Pair.java (-87 lines)
Lines 1-87 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.java.j2seprofiles;
44
45
/**
46
 * Just another copy of Pair.
47
 * @author Tomas Zezula
48
 */
49
final class Pair<P,K> {
50
51
    public final P first;
52
    public final K second;
53
54
    private Pair (P first, K second) {
55
        this.first = first;
56
        this.second = second;
57
    }
58
59
60
    public static <P,K> Pair<P,K> of (P first, K second) {
61
        return new Pair<P,K> (first,second);
62
    }
63
64
65
    @Override
66
    public int hashCode () {
67
        int hashCode  = 0;
68
        hashCode ^= first == null ? 0 : first.hashCode();
69
        hashCode ^= second == null ? 0: second.hashCode();
70
        return hashCode;
71
    }
72
73
    @Override
74
    public boolean equals (final Object other) {
75
        if (other instanceof Pair) {
76
            Pair<?,?> otherPair = (Pair<?,?>) other;
77
            return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) &&
78
                   (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second));
79
        }
80
        return false;
81
    }
82
83
    @Override
84
    public String toString () {
85
        return String.format("Pair[%s,%s]", first,second);
86
    }
87
}
(-)a/java.j2seprofiles/src/org/netbeans/modules/java/j2seprofiles/ProfilesAnalyzer.java (-7 / +8 lines)
Lines 107-112 Link Here
107
import org.openide.filesystems.FileUtil;
107
import org.openide.filesystems.FileUtil;
108
import org.openide.filesystems.URLMapper;
108
import org.openide.filesystems.URLMapper;
109
import org.openide.util.Exceptions;
109
import org.openide.util.Exceptions;
110
import org.openide.util.Pair;
110
import org.openide.util.lookup.ServiceProvider;
111
import org.openide.util.lookup.ServiceProvider;
111
112
112
/**
113
/**
Lines 188-194 Link Here
188
                    filterForRoot = Pair.<Set<FileObject>,Set<FileObject>>of(new HashSet<FileObject>(), new HashSet<FileObject>());
189
                    filterForRoot = Pair.<Set<FileObject>,Set<FileObject>>of(new HashSet<FileObject>(), new HashSet<FileObject>());
189
                    filter.put(ownerRoot, filterForRoot);
190
                    filter.put(ownerRoot, filterForRoot);
190
                }
191
                }
191
                filterForRoot.first.add(f);
192
                filterForRoot.first().add(f);
192
            }
193
            }
193
        }
194
        }
194
        for (FileObject f : scope.getFiles()) {
195
        for (FileObject f : scope.getFiles()) {
Lines 200-206 Link Here
200
                    filterForRoot = Pair.<Set<FileObject>,Set<FileObject>>of(new HashSet<FileObject>(), new HashSet<FileObject>());
201
                    filterForRoot = Pair.<Set<FileObject>,Set<FileObject>>of(new HashSet<FileObject>(), new HashSet<FileObject>());
201
                    filter.put(ownerRoot, filterForRoot);
202
                    filter.put(ownerRoot, filterForRoot);
202
                }
203
                }
203
                filterForRoot.second.add(f);
204
                filterForRoot.second().add(f);
204
            }
205
            }
205
        }
206
        }
206
        final ProfileProvider pp = new ProfileProvider(context);
207
        final ProfileProvider pp = new ProfileProvider(context);
Lines 249-261 Link Here
249
                    if (canceled.get()) {
250
                    if (canceled.get()) {
250
                        break;
251
                        break;
251
                    }
252
                    }
252
                    final URI rootURI = violationsPair.first.first;
253
                    final URI rootURI = violationsPair.first().first();
253
                    final Set<Project> projects = submittedBinaries.remove(violationsPair.first);
254
                    final Set<Project> projects = submittedBinaries.remove(violationsPair.first());
254
                    final boolean binary = projects != null;
255
                    final boolean binary = projects != null;
255
                    if (!binary) {
256
                    if (!binary) {
256
                        submittedSources.remove(rootURI);
257
                        submittedSources.remove(rootURI);
257
                    }
258
                    }
258
                    final Collection<? extends ProfileSupport.Violation> violations = violationsPair.second;
259
                    final Collection<? extends ProfileSupport.Violation> violations = violationsPair.second();
259
                    if (violations.isEmpty()) {
260
                    if (violations.isEmpty()) {
260
                        continue;
261
                        continue;
261
                    }
262
                    }
Lines 526-535 Link Here
526
        if (filter == null) {
527
        if (filter == null) {
527
            return true;
528
            return true;
528
        }
529
        }
529
        if (filter.second.contains(source)) {
530
        if (filter.second().contains(source)) {
530
            return true;
531
            return true;
531
        }
532
        }
532
        for (FileObject folder : filter.first) {
533
        for (FileObject folder : filter.first()) {
533
            if (folder.equals(source.getParent())) {
534
            if (folder.equals(source.getParent())) {
534
                return true;
535
                return true;
535
            }            
536
            }            
(-)a/java.navigation/nbproject/project.xml (-1 / +1 lines)
Lines 296-302 Link Here
296
                    <build-prerequisite/>
296
                    <build-prerequisite/>
297
                    <compile-dependency/>
297
                    <compile-dependency/>
298
                    <run-dependency>
298
                    <run-dependency>
299
                        <specification-version>8.0</specification-version>
299
                        <specification-version>8.32</specification-version>
300
                    </run-dependency>
300
                    </run-dependency>
301
                </dependency>
301
                </dependency>
302
                <dependency>
302
                <dependency>
(-)a/java.navigation/src/org/netbeans/modules/java/navigation/ClassMemberPanelUI.java (-4 / +4 lines)
Lines 96-102 Link Here
96
import org.netbeans.modules.java.navigation.actions.SortActions;
96
import org.netbeans.modules.java.navigation.actions.SortActions;
97
import org.netbeans.modules.java.navigation.base.FiltersManager;
97
import org.netbeans.modules.java.navigation.base.FiltersManager;
98
import org.netbeans.modules.java.navigation.base.HistorySupport;
98
import org.netbeans.modules.java.navigation.base.HistorySupport;
99
import org.netbeans.modules.java.navigation.base.Pair;
100
import org.netbeans.modules.java.navigation.base.Resolvers;
99
import org.netbeans.modules.java.navigation.base.Resolvers;
101
import org.netbeans.modules.java.navigation.base.SelectJavadocTask;
100
import org.netbeans.modules.java.navigation.base.SelectJavadocTask;
102
import org.openide.nodes.Node;
101
import org.openide.nodes.Node;
Lines 117-122 Link Here
117
import org.openide.util.Lookup;
116
import org.openide.util.Lookup;
118
import org.openide.util.Mutex;
117
import org.openide.util.Mutex;
119
import org.openide.util.NbPreferences;
118
import org.openide.util.NbPreferences;
119
import org.openide.util.Pair;
120
import org.openide.util.RequestProcessor;
120
import org.openide.util.RequestProcessor;
121
import org.openide.util.lookup.AbstractLookup;
121
import org.openide.util.lookup.AbstractLookup;
122
import org.openide.util.lookup.InstanceContent;
122
import org.openide.util.lookup.InstanceContent;
Lines 756-762 Link Here
756
            try {
756
            try {
757
                final Pair<URI,ElementHandle<TypeElement>> handlePair = becomesHandle.get();
757
                final Pair<URI,ElementHandle<TypeElement>> handlePair = becomesHandle.get();
758
                if (handlePair != null) {
758
                if (handlePair != null) {
759
                    final FileObject target = URLMapper.findFileObject(handlePair.first.toURL());
759
                    final FileObject target = URLMapper.findFileObject(handlePair.first().toURL());
760
                    if (target != null) {
760
                    if (target != null) {
761
                        final JavaSource targetJs = JavaSource.forFileObject(target);
761
                        final JavaSource targetJs = JavaSource.forFileObject(target);
762
                        if (targetJs != null) {
762
                        if (targetJs != null) {
Lines 766-777 Link Here
766
                        } else {
766
                        } else {
767
                            clearNodes();
767
                            clearNodes();
768
                            StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(
768
                            StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(
769
                                handlePair.second.getQualifiedName()));
769
                                handlePair.second().getQualifiedName()));
770
                        }
770
                        }
771
                    } else {
771
                    } else {
772
                        clearNodes();
772
                        clearNodes();
773
                        StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(
773
                        StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(
774
                                handlePair.second.getQualifiedName()));
774
                                handlePair.second().getQualifiedName()));
775
                    }
775
                    }
776
                } else {
776
                } else {
777
                    clearNodes();
777
                    clearNodes();
(-)a/java.navigation/src/org/netbeans/modules/java/navigation/base/HistorySupport.java (-4 / +5 lines)
Lines 68-73 Link Here
68
import org.netbeans.api.annotations.common.NullAllowed;
68
import org.netbeans.api.annotations.common.NullAllowed;
69
import org.netbeans.api.java.source.ElementHandle;
69
import org.netbeans.api.java.source.ElementHandle;
70
import org.openide.util.Mutex;
70
import org.openide.util.Mutex;
71
import org.openide.util.Pair;
71
import org.openide.util.Parameters;
72
import org.openide.util.Parameters;
72
import org.openide.util.WeakListeners;
73
import org.openide.util.WeakListeners;
73
74
Lines 181-188 Link Here
181
        @Override
182
        @Override
182
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
183
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
183
            String toolTipText = null;
184
            String toolTipText = null;
184
            if (value instanceof Pair && ((Pair)value).second instanceof ElementHandle) {
185
            if (value instanceof Pair && ((Pair)value).second() instanceof ElementHandle) {
185
                final String fqn =  ((ElementHandle)((Pair)value).second).getQualifiedName();
186
                final String fqn =  ((ElementHandle)((Pair)value).second()).getQualifiedName();
186
                value = getSimpleName(fqn);
187
                value = getSimpleName(fqn);
187
                toolTipText = fqn;
188
                toolTipText = fqn;
188
            }
189
            }
Lines 291-298 Link Here
291
292
292
        @Override
293
        @Override
293
        public int compare(Pair<URI, ElementHandle<TypeElement>> o1, Pair<URI, ElementHandle<TypeElement>> o2) {
294
        public int compare(Pair<URI, ElementHandle<TypeElement>> o1, Pair<URI, ElementHandle<TypeElement>> o2) {
294
            final String q1 = o1.second.getQualifiedName();
295
            final String q1 = o1.second().getQualifiedName();
295
            final String q2 = o2.second.getQualifiedName();
296
            final String q2 = o2.second().getQualifiedName();
296
            final String simpleName1 = getSimpleName(q1);
297
            final String simpleName1 = getSimpleName(q1);
297
            final String simpleName2 = getSimpleName(q2);
298
            final String simpleName2 = getSimpleName(q2);
298
            int res = simpleName1.compareTo(simpleName2);
299
            int res = simpleName1.compareTo(simpleName2);
(-)a/java.navigation/src/org/netbeans/modules/java/navigation/base/Pair.java (-75 lines)
Lines 1-75 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * Portions Copyrighted 2007 Sun Microsystems, Inc.
30
 */
31
package org.netbeans.modules.java.navigation.base;
32
33
/**
34
 *
35
 * @author Tomas Zezula
36
 */
37
public final class Pair<P,K> {
38
39
    public final P first;
40
    public final K second;
41
42
    private Pair (P first, K second) {
43
        this.first = first;
44
        this.second = second;
45
    }
46
47
    
48
    public static <P,K> Pair<P,K> of (P first, K second) {
49
        return new Pair<P,K> (first,second);
50
    }
51
    
52
    
53
    @Override
54
    public int hashCode () {
55
        int hashCode  = 0;
56
        hashCode ^= first == null ? 0 : first.hashCode();
57
        hashCode ^= second == null ? 0: second.hashCode();
58
        return hashCode;
59
    }
60
    
61
    @Override
62
    public boolean equals (final Object other) {
63
        if (other instanceof Pair) {
64
            Pair otherPair = (Pair) other;
65
            return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) &&
66
                   (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second));
67
        }
68
        return false;
69
    }
70
    
71
    @Override
72
    public String toString () {
73
        return String.format("Pair[%s,%s]", first,second);
74
    }
75
}
(-)a/java.navigation/src/org/netbeans/modules/java/navigation/base/Resolvers.java (+1 lines)
Lines 63-68 Link Here
63
import org.netbeans.api.java.source.JavaSource;
63
import org.netbeans.api.java.source.JavaSource;
64
import org.netbeans.api.java.source.Task;
64
import org.netbeans.api.java.source.Task;
65
import org.openide.filesystems.FileObject;
65
import org.openide.filesystems.FileObject;
66
import org.openide.util.Pair;
66
import org.openide.util.Parameters;
67
import org.openide.util.Parameters;
67
68
68
/**
69
/**
(-)a/java.navigation/src/org/netbeans/modules/java/navigation/base/SelectJavadocTask.java (-1 / +2 lines)
Lines 58-63 Link Here
58
import org.openide.nodes.Node;
58
import org.openide.nodes.Node;
59
import org.openide.util.Exceptions;
59
import org.openide.util.Exceptions;
60
import org.openide.util.Lookup;
60
import org.openide.util.Lookup;
61
import org.openide.util.Pair;
61
import org.openide.util.Parameters;
62
import org.openide.util.Parameters;
62
63
63
/**
64
/**
Lines 90-96 Link Here
90
                        final JavadocTopComponent tc = JavadocTopComponent.findInstance();
91
                        final JavadocTopComponent tc = JavadocTopComponent.findInstance();
91
                        if (tc != null) {
92
                        if (tc != null) {
92
                            tc.open();
93
                            tc.open();
93
                            tc.setJavadoc(documentation.first,documentation.second);
94
                            tc.setJavadoc(documentation.first(),documentation.second());
94
                        }
95
                        }
95
                    }
96
                    }
96
                });
97
                });
(-)a/java.navigation/src/org/netbeans/modules/java/navigation/hierarchy/HierarchyTopComponent.java (-7 / +7 lines)
Lines 95-101 Link Here
95
import org.netbeans.modules.java.navigation.JavadocTopComponent;
95
import org.netbeans.modules.java.navigation.JavadocTopComponent;
96
import org.netbeans.modules.java.navigation.NoBorderToolBar;
96
import org.netbeans.modules.java.navigation.NoBorderToolBar;
97
import org.netbeans.modules.java.navigation.base.HistorySupport;
97
import org.netbeans.modules.java.navigation.base.HistorySupport;
98
import org.netbeans.modules.java.navigation.base.Pair;
99
import org.netbeans.modules.java.navigation.base.Resolvers;
98
import org.netbeans.modules.java.navigation.base.Resolvers;
100
import org.netbeans.modules.java.navigation.base.SelectJavadocTask;
99
import org.netbeans.modules.java.navigation.base.SelectJavadocTask;
101
import org.netbeans.modules.java.navigation.base.TapPanel;
100
import org.netbeans.modules.java.navigation.base.TapPanel;
Lines 116-121 Link Here
116
import org.openide.util.NbPreferences;
115
import org.openide.util.NbPreferences;
117
import org.openide.windows.TopComponent;
116
import org.openide.windows.TopComponent;
118
import org.openide.util.NbBundle.Messages;
117
import org.openide.util.NbBundle.Messages;
118
import org.openide.util.Pair;
119
import org.openide.util.RequestProcessor;
119
import org.openide.util.RequestProcessor;
120
import org.openide.util.lookup.AbstractLookup;
120
import org.openide.util.lookup.AbstractLookup;
121
import org.openide.util.lookup.InstanceContent;
121
import org.openide.util.lookup.InstanceContent;
Lines 530-549 Link Here
530
                final Pair<URI,ElementHandle<TypeElement>> pair = toShow.get();
530
                final Pair<URI,ElementHandle<TypeElement>> pair = toShow.get();
531
                if (pair != null) {
531
                if (pair != null) {
532
                    if (viewType == ViewType.SUB_TYPE &&
532
                    if (viewType == ViewType.SUB_TYPE &&
533
                        Object.class.getName().equals(pair.second.getQualifiedName())) {
533
                        Object.class.getName().equals(pair.second().getQualifiedName())) {
534
                        nonActiveInfo.setText(Bundle.WARN_Object());
534
                        nonActiveInfo.setText(Bundle.WARN_Object());
535
                        ((CardLayout)contentView.getLayout()).show(contentView, NON_ACTIVE_CONTENT);
535
                        ((CardLayout)contentView.getLayout()).show(contentView, NON_ACTIVE_CONTENT);
536
                    } else {
536
                    } else {
537
                        final FileObject file = URLMapper.findFileObject(pair.first.toURL());
537
                        final FileObject file = URLMapper.findFileObject(pair.first().toURL());
538
                        JavaSource js;
538
                        JavaSource js;
539
                        if (file != null && (js=JavaSource.forFileObject(file)) != null) {
539
                        if (file != null && (js=JavaSource.forFileObject(file)) != null) {
540
                            LOG.log(Level.FINE, "Showing hierarchy for: {0}", pair.second.getQualifiedName());  //NOI18N
540
                            LOG.log(Level.FINE, "Showing hierarchy for: {0}", pair.second().getQualifiedName());  //NOI18N
541
                            history.addToHistory(pair);
541
                            history.addToHistory(pair);
542
                            js.runUserActionTask(new Task<CompilationController>() {
542
                            js.runUserActionTask(new Task<CompilationController>() {
543
                                @Override
543
                                @Override
544
                                public void run(CompilationController cc) throws Exception {
544
                                public void run(CompilationController cc) throws Exception {
545
                                    cc.toPhase(Phase.ELEMENTS_RESOLVED);
545
                                    cc.toPhase(Phase.ELEMENTS_RESOLVED);
546
                                    final TypeElement te = pair.second.resolve(cc);
546
                                    final TypeElement te = pair.second().resolve(cc);
547
                                    if (te != null) {
547
                                    if (te != null) {
548
                                        final Node root;
548
                                        final Node root;
549
                                        if (viewType == ViewType.SUPER_TYPE) {
549
                                        if (viewType == ViewType.SUPER_TYPE) {
Lines 583-589 Link Here
583
                            }, true);
583
                            }, true);
584
                        } else {
584
                        } else {
585
                            rootChildren.set(null);
585
                            rootChildren.set(null);
586
                            StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(pair.second.getQualifiedName()));
586
                            StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(pair.second().getQualifiedName()));
587
                        }
587
                        }
588
                    }
588
                    }
589
                } else {
589
                } else {
Lines 642-648 Link Here
642
            toolbar.setFocusable(false);
642
            toolbar.setFocusable(false);
643
            toolbar.setLayout(new GridBagLayout());
643
            toolbar.setLayout(new GridBagLayout());
644
            for (Pair<JComponent,GridBagConstraints> p : components) {
644
            for (Pair<JComponent,GridBagConstraints> p : components) {
645
                toolbar.add(p.first,p.second);
645
                toolbar.add(p.first(),p.second());
646
            }
646
            }
647
            add (toolbar);
647
            add (toolbar);
648
        }
648
        }
(-)a/java.source/nbproject/project.xml (-1 / +1 lines)
Lines 383-389 Link Here
383
                    <build-prerequisite/>
383
                    <build-prerequisite/>
384
                    <compile-dependency/>
384
                    <compile-dependency/>
385
                    <run-dependency>
385
                    <run-dependency>
386
                        <specification-version>8.25</specification-version>
386
                        <specification-version>8.32</specification-version>
387
                    </run-dependency>
387
                    </run-dependency>
388
                </dependency>
388
                </dependency>
389
                <dependency>
389
                <dependency>
(-)a/java.source/src/org/netbeans/api/java/source/CompilationInfo.java (-2 / +2 lines)
Lines 75-87 Link Here
75
import org.netbeans.modules.java.source.parsing.FileObjects;
75
import org.netbeans.modules.java.source.parsing.FileObjects;
76
import org.netbeans.modules.java.source.parsing.JavacParser;
76
import org.netbeans.modules.java.source.parsing.JavacParser;
77
import org.netbeans.modules.java.source.parsing.JavacParserResult;
77
import org.netbeans.modules.java.source.parsing.JavacParserResult;
78
import org.netbeans.modules.java.source.usages.Pair;
79
import org.netbeans.modules.parsing.api.Snapshot;
78
import org.netbeans.modules.parsing.api.Snapshot;
80
import org.netbeans.modules.parsing.spi.Parser;
79
import org.netbeans.modules.parsing.spi.Parser;
81
import org.openide.cookies.EditorCookie;
80
import org.openide.cookies.EditorCookie;
82
import org.openide.filesystems.FileObject;
81
import org.openide.filesystems.FileObject;
83
import org.openide.filesystems.FileUtil;
82
import org.openide.filesystems.FileUtil;
84
import org.openide.loaders.DataObject;
83
import org.openide.loaders.DataObject;
84
import org.openide.util.Pair;
85
import org.openide.util.Parameters;
85
import org.openide.util.Parameters;
86
86
87
/** Assorted information about the JavaSource.
87
/** Assorted information about the JavaSource.
Lines 171-177 Link Here
171
        if (cu == null) {
171
        if (cu == null) {
172
            return null;
172
            return null;
173
        }
173
        }
174
        return TreePath.getPath(cu, changedTree.second);
174
        return TreePath.getPath(cu, changedTree.second());
175
    }       
175
    }       
176
    
176
    
177
    /**
177
    /**
(-)a/java.source/src/org/netbeans/api/java/source/SourceUtils.java (-4 / +4 lines)
Lines 113-119 Link Here
113
import org.netbeans.modules.java.source.usages.ClassIndexManager;
113
import org.netbeans.modules.java.source.usages.ClassIndexManager;
114
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
114
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
115
import org.netbeans.modules.java.source.usages.ExecutableFilesIndex;
115
import org.netbeans.modules.java.source.usages.ExecutableFilesIndex;
116
import org.netbeans.modules.java.source.usages.Pair;
117
import org.netbeans.modules.parsing.api.ParserManager;
116
import org.netbeans.modules.parsing.api.ParserManager;
118
import org.netbeans.modules.parsing.api.ResultIterator;
117
import org.netbeans.modules.parsing.api.ResultIterator;
119
import org.netbeans.modules.parsing.api.UserTask;
118
import org.netbeans.modules.parsing.api.UserTask;
Lines 126-131 Link Here
126
import org.openide.filesystems.URLMapper;
125
import org.openide.filesystems.URLMapper;
127
import org.openide.util.Exceptions;
126
import org.openide.util.Exceptions;
128
import org.openide.util.Lookup;
127
import org.openide.util.Lookup;
128
import org.openide.util.Pair;
129
import org.openide.util.Parameters;
129
import org.openide.util.Parameters;
130
import org.openide.util.Utilities;
130
import org.openide.util.Utilities;
131
131
Lines 491-509 Link Here
491
            }
491
            }
492
            final List<Pair<FileObject,ClassPath>> fos = findAllResources(pkgName, cps);
492
            final List<Pair<FileObject,ClassPath>> fos = findAllResources(pkgName, cps);
493
            for (Pair<FileObject,ClassPath> pair : fos) {                
493
            for (Pair<FileObject,ClassPath> pair : fos) {                
494
                FileObject root = pair.second.findOwnerRoot(pair.first);
494
                FileObject root = pair.second().findOwnerRoot(pair.first());
495
                if (root == null)
495
                if (root == null)
496
                    continue;
496
                    continue;
497
                FileObject[] sourceRoots = SourceForBinaryQuery.findSourceRoots(root.toURL()).getRoots();                        
497
                FileObject[] sourceRoots = SourceForBinaryQuery.findSourceRoots(root.toURL()).getRoots();                        
498
                ClassPath sourcePath = ClassPathSupport.createClassPath(sourceRoots);
498
                ClassPath sourcePath = ClassPathSupport.createClassPath(sourceRoots);
499
                LinkedList<FileObject> folders = new LinkedList<FileObject>(sourcePath.findAllResources(pkgName));
499
                LinkedList<FileObject> folders = new LinkedList<FileObject>(sourcePath.findAllResources(pkgName));
500
                if (pkg) {
500
                if (pkg) {
501
                    return folders.isEmpty() ? pair.first : folders.get(0);
501
                    return folders.isEmpty() ? pair.first() : folders.get(0);
502
                } else {               
502
                } else {               
503
                    final boolean caseSensitive = isCaseSensitive ();
503
                    final boolean caseSensitive = isCaseSensitive ();
504
                    final String sourceFileName = getSourceFileName (className);
504
                    final String sourceFileName = getSourceFileName (className);
505
                    final Match matchSet = caseSensitive ? new CaseSensitiveMatch(sourceFileName) : new CaseInsensitiveMatch(sourceFileName);
505
                    final Match matchSet = caseSensitive ? new CaseSensitiveMatch(sourceFileName) : new CaseInsensitiveMatch(sourceFileName);
506
                    folders.addFirst(pair.first);
506
                    folders.addFirst(pair.first());
507
                    for (FileObject folder : folders) {
507
                    for (FileObject folder : folders) {
508
                        for (FileObject child : folder.getChildren()) {
508
                        for (FileObject child : folder.getChildren()) {
509
                            if (matchSet.apply(child)) {
509
                            if (matchSet.apply(child)) {
(-)a/java.source/src/org/netbeans/modules/java/source/classpath/SourcePath.java (-6 / +6 lines)
Lines 54-63 Link Here
54
import org.netbeans.modules.java.source.usages.ClassIndexManager;
54
import org.netbeans.modules.java.source.usages.ClassIndexManager;
55
import org.netbeans.modules.java.source.usages.ClassIndexManagerEvent;
55
import org.netbeans.modules.java.source.usages.ClassIndexManagerEvent;
56
import org.netbeans.modules.java.source.usages.ClassIndexManagerListener;
56
import org.netbeans.modules.java.source.usages.ClassIndexManagerListener;
57
import org.netbeans.modules.java.source.usages.Pair;
58
import org.netbeans.spi.java.classpath.ClassPathImplementation;
57
import org.netbeans.spi.java.classpath.ClassPathImplementation;
59
import org.netbeans.spi.java.classpath.FilteringPathResourceImplementation;
58
import org.netbeans.spi.java.classpath.FilteringPathResourceImplementation;
60
import org.netbeans.spi.java.classpath.PathResourceImplementation;
59
import org.netbeans.spi.java.classpath.PathResourceImplementation;
60
import org.openide.util.Pair;
61
import org.openide.util.Parameters;
61
import org.openide.util.Parameters;
62
import org.openide.util.WeakListeners;
62
import org.openide.util.WeakListeners;
63
63
Lines 155-163 Link Here
155
        @Override
155
        @Override
156
        public List<PathResourceImplementation> apply(
156
        public List<PathResourceImplementation> apply(
157
                @NonNull final Pair<Boolean,List<? extends PathResourceImplementation>> resources) {
157
                @NonNull final Pair<Boolean,List<? extends PathResourceImplementation>> resources) {
158
            final List<PathResourceImplementation> res = new ArrayList<PathResourceImplementation>(resources.second.size());
158
            final List<PathResourceImplementation> res = new ArrayList<PathResourceImplementation>(resources.second().size());
159
            for (PathResourceImplementation pr : resources.second) {
159
            for (PathResourceImplementation pr : resources.second()) {
160
                res.add(new FR(pr,resources.first));
160
                res.add(new FR(pr,resources.first()));
161
            }
161
            }
162
            return res;
162
            return res;
163
        }
163
        }
Lines 169-176 Link Here
169
169
170
        @Override
170
        @Override
171
        public List<PathResourceImplementation> apply(Pair<Boolean, List<? extends PathResourceImplementation>> resources) {
171
        public List<PathResourceImplementation> apply(Pair<Boolean, List<? extends PathResourceImplementation>> resources) {
172
            final List<PathResourceImplementation> res = new ArrayList<PathResourceImplementation>(resources.second.size());
172
            final List<PathResourceImplementation> res = new ArrayList<PathResourceImplementation>(resources.second().size());
173
            for (PathResourceImplementation pr : resources.second) {
173
            for (PathResourceImplementation pr : resources.second()) {
174
                res.add(new FR(pr,true));
174
                res.add(new FR(pr,true));
175
            }
175
            }
176
            return res;
176
            return res;
(-)a/java.source/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java (-6 / +7 lines)
Lines 120-125 Link Here
120
import org.openide.util.Exceptions;
120
import org.openide.util.Exceptions;
121
import org.openide.util.ImageUtilities;
121
import org.openide.util.ImageUtilities;
122
import org.openide.util.NbBundle;
122
import org.openide.util.NbBundle;
123
import org.openide.util.Pair;
123
import org.openide.util.Parameters;
124
import org.openide.util.Parameters;
124
import org.openide.util.TopologicalSortException;
125
import org.openide.util.TopologicalSortException;
125
import org.openide.util.Utilities;
126
import org.openide.util.Utilities;
Lines 471-481 Link Here
471
            }
472
            }
472
        }
473
        }
473
        for (Pair<String,URL> relURLPair : sourceRelativeURLPairs) {
474
        for (Pair<String,URL> relURLPair : sourceRelativeURLPairs) {
474
            final String ext = FileObjects.getExtension(relURLPair.first);
475
            final String ext = FileObjects.getExtension(relURLPair.first());
475
            final String withoutExt = FileObjects.stripExtension(relURLPair.first);
476
            final String withoutExt = FileObjects.stripExtension(relURLPair.first());
476
            final boolean dieIfNoRefFile = VirtualSourceProviderQuery.hasVirtualSource(ext);
477
            final boolean dieIfNoRefFile = VirtualSourceProviderQuery.hasVirtualSource(ext);
477
            if (dieIfNoRefFile) {
478
            if (dieIfNoRefFile) {
478
                file = new File(classFolder, relURLPair.first + '.' + FileObjects.RX);
479
                file = new File(classFolder, relURLPair.first() + '.' + FileObjects.RX);
479
            } else {
480
            } else {
480
                file = new File(classFolder, withoutExt + '.' + FileObjects.RS);
481
                file = new File(classFolder, withoutExt + '.' + FileObjects.RS);
481
            }
482
            }
Lines 487-494 Link Here
487
                    for (String className : readRSFile(file)) {
488
                    for (String className : readRSFile(file)) {
488
                        File f = new File(classFolder, FileObjects.convertPackage2Folder(className) + '.' + FileObjects.SIG);
489
                        File f = new File(classFolder, FileObjects.convertPackage2Folder(className) + '.' + FileObjects.SIG);
489
                        if (!binaryName.equals(className)) {
490
                        if (!binaryName.equals(className)) {
490
                            if (javaContext.getFQNs().remove(className, relURLPair.second)) {
491
                            if (javaContext.getFQNs().remove(className, relURLPair.second())) {
491
                                toDelete.add(Pair.<String, String>of(className, relURLPair.first));
492
                                toDelete.add(Pair.<String, String>of(className, relURLPair.first()));
492
                                removedTypes.add(ElementHandleAccessor.getInstance().create(ElementKind.OTHER, className));
493
                                removedTypes.add(ElementHandleAccessor.getInstance().create(ElementKind.OTHER, className));
493
                                removedFiles.add(f);
494
                                removedFiles.add(f);
494
                                fmTx.delete(f);
495
                                fmTx.delete(f);
Lines 504-510 Link Here
504
                fmTx.delete(file);
505
                fmTx.delete(file);
505
            }
506
            }
506
            if (cont && (file = new File(classFolder, withoutExt + '.' + FileObjects.SIG)).exists()) {
507
            if (cont && (file = new File(classFolder, withoutExt + '.' + FileObjects.SIG)).exists()) {
507
                if (javaContext.getFQNs().remove(FileObjects.getBinaryName(file, classFolder), relURLPair.second)) {
508
                if (javaContext.getFQNs().remove(FileObjects.getBinaryName(file, classFolder), relURLPair.second())) {
508
                    String fileName = file.getName();
509
                    String fileName = file.getName();
509
                    fileName = fileName.substring(0, fileName.lastIndexOf('.'));
510
                    fileName = fileName.substring(0, fileName.lastIndexOf('.'));
510
                    final String[][] patterns = new String[][]{
511
                    final String[][] patterns = new String[][]{
(-)a/java.source/src/org/netbeans/modules/java/source/indexing/JavaParsingContext.java (-1 / +1 lines)
Lines 75-86 Link Here
75
import org.netbeans.modules.java.source.usages.ClassIndexImpl;
75
import org.netbeans.modules.java.source.usages.ClassIndexImpl;
76
import org.netbeans.modules.java.source.usages.ClassIndexManager;
76
import org.netbeans.modules.java.source.usages.ClassIndexManager;
77
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
77
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
78
import org.netbeans.modules.java.source.usages.Pair;
79
import org.netbeans.modules.java.source.usages.SourceAnalyzerFactory;
78
import org.netbeans.modules.java.source.usages.SourceAnalyzerFactory;
80
import org.netbeans.modules.parsing.spi.indexing.Context;
79
import org.netbeans.modules.parsing.spi.indexing.Context;
81
import org.netbeans.modules.parsing.spi.indexing.Indexable;
80
import org.netbeans.modules.parsing.spi.indexing.Indexable;
82
import org.openide.filesystems.FileObject;
81
import org.openide.filesystems.FileObject;
83
import org.openide.util.Lookup;
82
import org.openide.util.Lookup;
83
import org.openide.util.Pair;
84
import org.openide.util.lookup.Lookups;
84
import org.openide.util.lookup.Lookups;
85
85
86
//@NotThreadSafe
86
//@NotThreadSafe
(-)a/java.source/src/org/netbeans/modules/java/source/indexing/OnePassCompileWorker.java (-8 / +8 lines)
Lines 76-88 Link Here
76
import org.netbeans.modules.java.source.usages.ClassNamesForFileOraculumImpl;
76
import org.netbeans.modules.java.source.usages.ClassNamesForFileOraculumImpl;
77
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
77
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
78
import org.netbeans.modules.java.source.usages.ExecutableFilesIndex;
78
import org.netbeans.modules.java.source.usages.ExecutableFilesIndex;
79
import org.netbeans.modules.java.source.usages.Pair;
80
import org.netbeans.modules.parsing.lucene.support.LowMemoryWatcher;
79
import org.netbeans.modules.parsing.lucene.support.LowMemoryWatcher;
81
import org.netbeans.modules.parsing.spi.indexing.Context;
80
import org.netbeans.modules.parsing.spi.indexing.Context;
82
import org.netbeans.modules.parsing.spi.indexing.Indexable;
81
import org.netbeans.modules.parsing.spi.indexing.Indexable;
83
import org.netbeans.modules.parsing.spi.indexing.SuspendStatus;
82
import org.netbeans.modules.parsing.spi.indexing.SuspendStatus;
84
import org.openide.filesystems.FileUtil;
83
import org.openide.filesystems.FileUtil;
85
import org.openide.util.Exceptions;
84
import org.openide.util.Exceptions;
85
import org.openide.util.Pair;
86
86
87
/**
87
/**
88
 *
88
 *
Lines 217-223 Link Here
217
                    return null;
217
                    return null;
218
                }
218
                }
219
                Pair<CompilationUnitTree, CompileTuple> unit = units.removeFirst();
219
                Pair<CompilationUnitTree, CompileTuple> unit = units.removeFirst();
220
                active = unit.second;
220
                active = unit.second();
221
                if (finished.contains(active.indexable)) {
221
                if (finished.contains(active.indexable)) {
222
                    continue;
222
                    continue;
223
                }
223
                }
Lines 228-234 Link Here
228
                }
228
                }
229
                Iterable<? extends TypeElement> types;
229
                Iterable<? extends TypeElement> types;
230
                s = System.nanoTime();
230
                s = System.nanoTime();
231
                types = jt.enterTrees(Collections.singletonList(unit.first));
231
                types = jt.enterTrees(Collections.singletonList(unit.first()));
232
                total += System.nanoTime() - s;
232
                total += System.nanoTime() - s;
233
                if (jfo2units.remove(active.jfo) != null) {
233
                if (jfo2units.remove(active.jfo) != null) {
234
                    final Types ts = Types.instance(jt.getContext());
234
                    final Types ts = Types.instance(jt.getContext());
Lines 242-250 Link Here
242
                                if (st.hasTag(TypeTag.CLASS)) {
242
                                if (st.hasTag(TypeTag.CLASS)) {
243
                                    ClassSymbol c = st.tsym.outermostClass();
243
                                    ClassSymbol c = st.tsym.outermostClass();
244
                                    Pair<CompilationUnitTree, CompileTuple> u = jfo2units.remove(c.sourcefile);
244
                                    Pair<CompilationUnitTree, CompileTuple> u = jfo2units.remove(c.sourcefile);
245
                                    if (u != null && !finished.contains(u.second.indexable) && !u.second.indexable.equals(activeIndexable)) {
245
                                    if (u != null && !finished.contains(u.second().indexable) && !u.second().indexable.equals(activeIndexable)) {
246
                                        if (dependencies.add(u)) {
246
                                        if (dependencies.add(u)) {
247
                                            scan((JCCompilationUnit)u.first);
247
                                            scan((JCCompilationUnit)u.first());
248
                                        }
248
                                        }
249
                                    }
249
                                    }
250
                                }
250
                                }
Lines 253-259 Link Here
253
                        }
253
                        }
254
                    }
254
                    }
255
                    ScanNested scanner = new ScanNested();
255
                    ScanNested scanner = new ScanNested();
256
                    scanner.scan((JCCompilationUnit)unit.first);
256
                    scanner.scan((JCCompilationUnit)unit.first());
257
                    if (!scanner.dependencies.isEmpty()) {
257
                    if (!scanner.dependencies.isEmpty()) {
258
                        units.addFirst(unit);
258
                        units.addFirst(unit);
259
                        for (Pair<CompilationUnitTree, CompileTuple> pair : scanner.dependencies) {
259
                        for (Pair<CompilationUnitTree, CompileTuple> pair : scanner.dependencies) {
Lines 281-290 Link Here
281
                javaContext.getFQNs().set(types, active.indexable.getURL());
281
                javaContext.getFQNs().set(types, active.indexable.getURL());
282
                boolean[] main = new boolean[1];
282
                boolean[] main = new boolean[1];
283
                if (javaContext.getCheckSums().checkAndSet(active.indexable.getURL(), types, jt.getElements()) || context.isSupplementaryFilesIndexing()) {
283
                if (javaContext.getCheckSums().checkAndSet(active.indexable.getURL(), types, jt.getElements()) || context.isSupplementaryFilesIndexing()) {
284
                    javaContext.analyze(Collections.singleton(unit.first), jt, unit.second, addedTypes, main);
284
                    javaContext.analyze(Collections.singleton(unit.first()), jt, unit.second(), addedTypes, main);
285
                } else {
285
                } else {
286
                    final Set<ElementHandle<TypeElement>> aTypes = new HashSet<ElementHandle<TypeElement>>();
286
                    final Set<ElementHandle<TypeElement>> aTypes = new HashSet<ElementHandle<TypeElement>>();
287
                    javaContext.analyze(Collections.singleton(unit.first), jt, unit.second, aTypes, main);
287
                    javaContext.analyze(Collections.singleton(unit.first()), jt, unit.second(), aTypes, main);
288
                    addedTypes.addAll(aTypes);
288
                    addedTypes.addAll(aTypes);
289
                    modifiedTypes.addAll(aTypes);
289
                    modifiedTypes.addAll(aTypes);
290
                }
290
                }
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/CachingArchiveProvider.java (-4 / +4 lines)
Lines 58-68 Link Here
58
import org.netbeans.api.annotations.common.NonNull;
58
import org.netbeans.api.annotations.common.NonNull;
59
import org.netbeans.api.java.platform.JavaPlatform;
59
import org.netbeans.api.java.platform.JavaPlatform;
60
import org.netbeans.api.java.platform.JavaPlatformManager;
60
import org.netbeans.api.java.platform.JavaPlatformManager;
61
import org.netbeans.modules.java.source.usages.Pair;
62
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileObject;
63
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
64
import org.openide.filesystems.URLMapper;
63
import org.openide.filesystems.URLMapper;
65
import org.openide.util.Exceptions;
64
import org.openide.util.Exceptions;
65
import org.openide.util.Pair;
66
import org.openide.util.Utilities;
66
import org.openide.util.Utilities;
67
67
68
68
Lines 197-203 Link Here
197
        }
197
        }
198
        synchronized (this) {
198
        synchronized (this) {
199
            final Pair<File,String> res = mapJarToCtSym(f, root);
199
            final Pair<File,String> res = mapJarToCtSym(f, root);
200
            return res.second != null;
200
            return res.second() != null;
201
        }
201
        }
202
202
203
    }
203
    }
Lines 233-240 Link Here
233
                if (f.isFile()) {
233
                if (f.isFile()) {
234
                    final Pair<File,String> resolved = mapJarToCtSym(f, root);
234
                    final Pair<File,String> resolved = mapJarToCtSym(f, root);
235
                    return new CachingArchive(
235
                    return new CachingArchive(
236
                            resolved.first,
236
                            resolved.first(),
237
                            resolved.second,
237
                            resolved.second(),
238
                            cacheFile);
238
                            cacheFile);
239
                }
239
                }
240
                else {
240
                else {
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/CompilationInfoImpl.java (-1 / +1 lines)
Lines 74-86 Link Here
74
import org.netbeans.api.java.source.JavaSource;
74
import org.netbeans.api.java.source.JavaSource;
75
import org.netbeans.api.lexer.TokenHierarchy;
75
import org.netbeans.api.lexer.TokenHierarchy;
76
import org.netbeans.modules.java.source.JavaFileFilterQuery;
76
import org.netbeans.modules.java.source.JavaFileFilterQuery;
77
import org.netbeans.modules.java.source.usages.Pair;
78
import org.netbeans.modules.parsing.api.Snapshot;
77
import org.netbeans.modules.parsing.api.Snapshot;
79
import org.openide.cookies.EditorCookie;
78
import org.openide.cookies.EditorCookie;
80
import org.openide.filesystems.FileObject;
79
import org.openide.filesystems.FileObject;
81
import org.openide.loaders.DataObject;
80
import org.openide.loaders.DataObject;
82
import org.openide.loaders.DataObjectNotFoundException;
81
import org.openide.loaders.DataObjectNotFoundException;
83
import org.openide.util.Exceptions;
82
import org.openide.util.Exceptions;
83
import org.openide.util.Pair;
84
84
85
/**
85
/**
86
 *
86
 *
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/FindMethodRegionsVisitor.java (-2 / +1 lines)
Lines 53-60 Link Here
53
import java.util.concurrent.atomic.AtomicBoolean;
53
import java.util.concurrent.atomic.AtomicBoolean;
54
import javax.swing.text.BadLocationException;
54
import javax.swing.text.BadLocationException;
55
import javax.swing.text.Document;
55
import javax.swing.text.Document;
56
import org.netbeans.modules.java.source.usages.Pair;
56
import org.openide.util.Pair;
57
import org.openide.util.Exceptions;
58
57
59
/**
58
/**
60
 *
59
 *
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/JavacParser.java (-4 / +4 lines)
Lines 145-151 Link Here
145
import org.netbeans.modules.java.source.tasklist.CompilerSettings;
145
import org.netbeans.modules.java.source.tasklist.CompilerSettings;
146
import org.netbeans.modules.java.source.usages.ClassIndexImpl;
146
import org.netbeans.modules.java.source.usages.ClassIndexImpl;
147
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
147
import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
148
import org.netbeans.modules.java.source.usages.Pair;
149
import org.netbeans.modules.parsing.api.Snapshot;
148
import org.netbeans.modules.parsing.api.Snapshot;
150
import org.netbeans.modules.parsing.api.Source;
149
import org.netbeans.modules.parsing.api.Source;
151
import org.netbeans.modules.parsing.api.Task;
150
import org.netbeans.modules.parsing.api.Task;
Lines 163-168 Link Here
163
import org.openide.modules.SpecificationVersion;
162
import org.openide.modules.SpecificationVersion;
164
import org.openide.util.ChangeSupport;
163
import org.openide.util.ChangeSupport;
165
import org.openide.util.Exceptions;
164
import org.openide.util.Exceptions;
165
import org.openide.util.Pair;
166
import org.openide.util.WeakListeners;
166
import org.openide.util.WeakListeners;
167
167
168
/**
168
/**
Lines 432-439 Link Here
432
                    if (supportsReparse) {
432
                    if (supportsReparse) {
433
                        final Pair<DocPositionRegion,MethodTree> _changedMethod = changedMethod.getAndSet(null);
433
                        final Pair<DocPositionRegion,MethodTree> _changedMethod = changedMethod.getAndSet(null);
434
                        if (_changedMethod != null && ciImpl != null) {
434
                        if (_changedMethod != null && ciImpl != null) {
435
                            LOGGER.log(Level.FINE, "\t:trying partial reparse:\n{0}", _changedMethod.first.getText());                           //NOI18N
435
                            LOGGER.log(Level.FINE, "\t:trying partial reparse:\n{0}", _changedMethod.first().getText());                           //NOI18N
436
                            needsFullReparse = !reparseMethod(ciImpl, snapshot, _changedMethod.second, _changedMethod.first.getText());
436
                            needsFullReparse = !reparseMethod(ciImpl, snapshot, _changedMethod.second(), _changedMethod.first().getText());
437
                            if (!needsFullReparse) {
437
                            if (!needsFullReparse) {
438
                                ciImpl.setChangedMethod(_changedMethod);
438
                                ciImpl.setChangedMethod(_changedMethod);
439
                            }
439
                            }
Lines 1243-1249 Link Here
1243
                    int end = evt.affectedEndOffset();
1243
                    int end = evt.affectedEndOffset();
1244
                    synchronized (positions) {
1244
                    synchronized (positions) {
1245
                        for (Pair<DocPositionRegion,MethodTree> pe : positions) {
1245
                        for (Pair<DocPositionRegion,MethodTree> pe : positions) {
1246
                            PositionRegion p = pe.first;
1246
                            PositionRegion p = pe.first();
1247
                            if (start > p.getStartOffset() && end < p.getEndOffset()) {
1247
                            if (start > p.getStartOffset() && end < p.getEndOffset()) {
1248
                                changedMethod = pe;
1248
                                changedMethod = pe;
1249
                                break;
1249
                                break;
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/ProcessorGenerated.java (-6 / +6 lines)
Lines 68-75 Link Here
68
import org.netbeans.modules.java.source.classpath.AptCacheForSourceQuery;
68
import org.netbeans.modules.java.source.classpath.AptCacheForSourceQuery;
69
import org.netbeans.modules.java.source.indexing.JavaIndex;
69
import org.netbeans.modules.java.source.indexing.JavaIndex;
70
import org.netbeans.modules.java.source.indexing.TransactionContext;
70
import org.netbeans.modules.java.source.indexing.TransactionContext;
71
import org.netbeans.modules.java.source.usages.Pair;
72
import org.openide.util.Exceptions;
71
import org.openide.util.Exceptions;
72
import org.openide.util.Pair;
73
import org.openide.util.Parameters;
73
import org.openide.util.Parameters;
74
import org.openide.util.Utilities;
74
import org.openide.util.Utilities;
75
75
Lines 107-113 Link Here
107
    public Set<javax.tools.FileObject> getGeneratedSources(final URL forSource) {
107
    public Set<javax.tools.FileObject> getGeneratedSources(final URL forSource) {
108
        Pair<Set<javax.tools.FileObject>,Set<javax.tools.FileObject>> res = 
108
        Pair<Set<javax.tools.FileObject>,Set<javax.tools.FileObject>> res = 
109
            generated.get(forSource);
109
            generated.get(forSource);
110
        return res == null ? null : res.first;
110
        return res == null ? null : res.first();
111
    }
111
    }
112
    
112
    
113
    public boolean canWrite() {
113
    public boolean canWrite() {
Lines 173-182 Link Here
173
        }
173
        }
174
        switch (type) {
174
        switch (type) {
175
            case SOURCE:
175
            case SOURCE:
176
                insertInto.first.add(file);
176
                insertInto.first().add(file);
177
                break;
177
                break;
178
            case RESOURCE:
178
            case RESOURCE:
179
                insertInto.second.add(file);
179
                insertInto.second().add(file);
180
                break;
180
                break;
181
            default:
181
            default:
182
                throw new IllegalArgumentException();
182
                throw new IllegalArgumentException();
Lines 196-203 Link Here
196
                for (Map.Entry<URL,Pair<Set<javax.tools.FileObject>,Set<javax.tools.FileObject>>> entry : generated.entrySet()) {
196
                for (Map.Entry<URL,Pair<Set<javax.tools.FileObject>,Set<javax.tools.FileObject>>> entry : generated.entrySet()) {
197
                    final URL source = entry.getKey();
197
                    final URL source = entry.getKey();
198
                    final Pair<Set<javax.tools.FileObject>,Set<javax.tools.FileObject>> gen = entry.getValue();
198
                    final Pair<Set<javax.tools.FileObject>,Set<javax.tools.FileObject>> gen = entry.getValue();
199
                    final Set<javax.tools.FileObject> genSources = gen.first;
199
                    final Set<javax.tools.FileObject> genSources = gen.first();
200
                    final Set<javax.tools.FileObject> genResources =  gen.second;
200
                    final Set<javax.tools.FileObject> genResources =  gen.second();
201
                    commitSource(source, genSources, genResources);
201
                    commitSource(source, genSources, genResources);
202
                }
202
                }
203
                writeResources();
203
                writeResources();
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/SiblingSupport.java (-6 / +6 lines)
Lines 47-53 Link Here
47
import java.util.logging.Level;
47
import java.util.logging.Level;
48
import java.util.logging.Logger;
48
import java.util.logging.Logger;
49
import org.netbeans.api.annotations.common.NonNull;
49
import org.netbeans.api.annotations.common.NonNull;
50
import org.netbeans.modules.java.source.usages.Pair;
50
import org.openide.util.Pair;
51
51
52
/**
52
/**
53
 *
53
 *
Lines 81-87 Link Here
81
        } else {
81
        } else {
82
            LOG.log(Level.FINE, "Poped sibling: {0} size: {1}", new Object[] {removed, siblings.size()});     //NOI18N
82
            LOG.log(Level.FINE, "Poped sibling: {0} size: {1}", new Object[] {removed, siblings.size()});     //NOI18N
83
        }
83
        }
84
        return removed.first;
84
        return removed.first();
85
    }
85
    }
86
86
87
    @Override
87
    @Override
Lines 104-113 Link Here
104
                Level.FINER,
104
                Level.FINER,
105
                "Returns sibling: {0} in source root? {1}",    //NOI18N
105
                "Returns sibling: {0} in source root? {1}",    //NOI18N
106
                new Object[] {
106
                new Object[] {
107
                    result.first,
107
                    result.first(),
108
                    result.second
108
                    result.second()
109
                });
109
                });
110
            return result.first;
110
            return result.first();
111
        }
111
        }
112
112
113
        @Override
113
        @Override
Lines 119-125 Link Here
119
119
120
        @Override
120
        @Override
121
        public boolean isInSourceRoot() {
121
        public boolean isInSourceRoot() {
122
            return siblings.peek().second;
122
            return siblings.peek().second();
123
        }
123
        }
124
    }
124
    }
125
125
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/WriteBackTransaction.java (-15 / +15 lines)
Lines 68-75 Link Here
68
import org.netbeans.api.annotations.common.NonNull;
68
import org.netbeans.api.annotations.common.NonNull;
69
import org.netbeans.api.annotations.common.NullAllowed;
69
import org.netbeans.api.annotations.common.NullAllowed;
70
import org.netbeans.modules.java.preprocessorbridge.spi.JavaFileFilterImplementation;
70
import org.netbeans.modules.java.preprocessorbridge.spi.JavaFileFilterImplementation;
71
import org.netbeans.modules.java.source.usages.Pair;
72
import org.netbeans.modules.java.source.util.Iterators;
71
import org.netbeans.modules.java.source.util.Iterators;
72
import org.openide.util.Pair;
73
import org.openide.util.Utilities;
73
import org.openide.util.Utilities;
74
74
75
/**
75
/**
Lines 270-280 Link Here
270
            @NonNull final Location location,
270
            @NonNull final Location location,
271
            final boolean readOnly) {
271
            final boolean readOnly) {
272
        if (location == StandardLocation.CLASS_OUTPUT) {
272
        if (location == StandardLocation.CLASS_OUTPUT) {
273
            return contentCache.first;
273
            return contentCache.first();
274
        } else if (location == StandardLocation.SOURCE_OUTPUT) {
274
        } else if (location == StandardLocation.SOURCE_OUTPUT) {
275
            return contentCache.second;
275
            return contentCache.second();
276
        } else if (readOnly && location == StandardLocation.CLASS_PATH) {
276
        } else if (readOnly && location == StandardLocation.CLASS_PATH) {
277
            return contentCache.first;
277
            return contentCache.first();
278
        } else {
278
        } else {
279
            throw new IllegalArgumentException("Unsupported Location: " + location);    //NOI18N
279
            throw new IllegalArgumentException("Unsupported Location: " + location);    //NOI18N
280
        }
280
        }
Lines 298-305 Link Here
298
298
299
    private void flushFiles(boolean inCommit) throws IOException {
299
    private void flushFiles(boolean inCommit) throws IOException {
300
        LOG.log(Level.FINE, "Flushing:{0}", getRootDir());
300
        LOG.log(Level.FINE, "Flushing:{0}", getRootDir());
301
        doFlushFiles(contentCache.first, inCommit);
301
        doFlushFiles(contentCache.first(), inCommit);
302
        doFlushFiles(contentCache.second, inCommit);
302
        doFlushFiles(contentCache.second(), inCommit);
303
    }
303
    }
304
304
305
    private void doFlushFiles(
305
    private void doFlushFiles(
Lines 326-333 Link Here
326
            FileObjects.deleteRecursively(d);
326
            FileObjects.deleteRecursively(d);
327
        }
327
        }
328
        deleted.clear();
328
        deleted.clear();
329
        contentCache.first.clear();
329
        contentCache.first().clear();
330
        contentCache.second.clear();
330
        contentCache.second().clear();
331
    }
331
    }
332
332
333
    @Override
333
    @Override
Lines 426-432 Link Here
426
                        (FileObjects.FileBase)FileObjects.fileFileObject(shadowFile, getRootFile(shadowFile, getPackage()), filter, encoding),
426
                        (FileObjects.FileBase)FileObjects.fileFileObject(shadowFile, getRootFile(shadowFile, getPackage()), filter, encoding),
427
                        Boolean.TRUE);
427
                        Boolean.TRUE);
428
            }
428
            }
429
            return delegate.first;
429
            return delegate.first();
430
        }
430
        }
431
        
431
        
432
        public File getCurrentFile() {
432
        public File getCurrentFile() {
Lines 442-448 Link Here
442
            if (wasFlushed()) {
442
            if (wasFlushed()) {
443
                return;
443
                return;
444
            }
444
            }
445
            if (delegate != null && delegate.second == Boolean.FALSE) {
445
            if (delegate != null && delegate.second() == Boolean.FALSE) {
446
                if (inCommit) {
446
                if (inCommit) {
447
                    shadowFile = this.f;
447
                    shadowFile = this.f;
448
                    release();
448
                    release();
Lines 510-517 Link Here
510
510
511
        @Override
511
        @Override
512
        public boolean delete() {
512
        public boolean delete() {
513
            if (delegate != null && delegate.second == Boolean.TRUE) {
513
            if (delegate != null && delegate.second() == Boolean.TRUE) {
514
                return delegate.first.delete();
514
                return delegate.first().delete();
515
            } else {
515
            } else {
516
                if (writer != null) {
516
                if (writer != null) {
517
                    writer.delete(toFile(this));
517
                    writer.delete(toFile(this));
Lines 523-529 Link Here
523
        @Override
523
        @Override
524
        public InputStream openInputStream() throws IOException {
524
        public InputStream openInputStream() throws IOException {
525
            if (delegate != null) {
525
            if (delegate != null) {
526
                return delegate.first.openInputStream();
526
                return delegate.first().openInputStream();
527
            } else {
527
            } else {
528
                return new ByteArrayInputStream(content);
528
                return new ByteArrayInputStream(content);
529
            }
529
            }
Lines 533-539 Link Here
533
        public OutputStream openOutputStream() throws IOException {
533
        public OutputStream openOutputStream() throws IOException {
534
            modify();
534
            modify();
535
            if (delegate != null) {
535
            if (delegate != null) {
536
                return delegate.first.openOutputStream();
536
                return delegate.first().openOutputStream();
537
            } else {
537
            } else {
538
                return new ByteArrayOutputStream() {
538
                return new ByteArrayOutputStream() {
539
                    boolean closed;
539
                    boolean closed;
Lines 554-560 Link Here
554
        }
554
        }
555
555
556
        private void modify() {
556
        private void modify() {
557
            if (delegate != null && delegate.second == Boolean.FALSE) {
557
            if (delegate != null && delegate.second() == Boolean.FALSE) {
558
                delegate = null;
558
                delegate = null;
559
            }
559
            }
560
        }
560
        }
(-)a/java.source/src/org/netbeans/modules/java/source/save/PositionEstimator.java (-4 / +4 lines)
Lines 62-72 Link Here
62
import org.netbeans.api.editor.guards.GuardedSectionManager;
62
import org.netbeans.api.editor.guards.GuardedSectionManager;
63
import org.netbeans.api.java.lexer.JavaTokenId;
63
import org.netbeans.api.java.lexer.JavaTokenId;
64
import org.netbeans.modules.java.source.transform.FieldGroupTree;
64
import org.netbeans.modules.java.source.transform.FieldGroupTree;
65
import org.netbeans.modules.java.source.usages.Pair;
66
import static org.netbeans.api.java.lexer.JavaTokenId.*;
65
import static org.netbeans.api.java.lexer.JavaTokenId.*;
67
import org.netbeans.api.lexer.Token;
66
import org.netbeans.api.lexer.Token;
68
import org.netbeans.api.lexer.TokenSequence;
67
import org.netbeans.api.lexer.TokenSequence;
69
import org.netbeans.modules.java.source.save.CasualDiff.LineInsertionType;
68
import org.netbeans.modules.java.source.save.CasualDiff.LineInsertionType;
69
import org.openide.util.Pair;
70
70
71
/**
71
/**
72
 * Estimates the position for given element or element set. Offsets are
72
 * Estimates the position for given element or element set. Offsets are
Lines 997-1003 Link Here
997
                                    if (commentEndPos.isEmpty()) {
997
                                    if (commentEndPos.isEmpty()) {
998
                                        wideEnd = seq.offset() + indexOf + 1;
998
                                        wideEnd = seq.offset() + indexOf + 1;
999
                                    } else {
999
                                    } else {
1000
                                        commentEndPos.add(Pair.of(commentEndPos.getLast().first, seq.offset() + indexOf + 1));                                            
1000
                                        commentEndPos.add(Pair.of(commentEndPos.getLast().first(), seq.offset() + indexOf + 1));
1001
                                    }
1001
                                    }
1002
                                }
1002
                                }
1003
                            }
1003
                            }
Lines 1031-1038 Link Here
1031
                }
1031
                }
1032
                maxLines = Math.max(maxLines, newlines);
1032
                maxLines = Math.max(maxLines, newlines);
1033
                for (Pair<Integer, Integer> comment : commentEndPos) {
1033
                for (Pair<Integer, Integer> comment : commentEndPos) {
1034
                    if (comment.first < maxLines || comment.first == 0) {
1034
                    if (comment.first() < maxLines || comment.first() == 0) {
1035
                        wideEnd = comment.second;
1035
                        wideEnd = comment.second();
1036
                    } else {
1036
                    } else {
1037
                        break;
1037
                        break;
1038
                    }
1038
                    }
(-)a/java.source/src/org/netbeans/modules/java/source/save/Reformatter.java (-10 / +10 lines)
Lines 66-72 Link Here
66
import org.netbeans.modules.java.source.JavaSourceAccessor;
66
import org.netbeans.modules.java.source.JavaSourceAccessor;
67
import org.netbeans.modules.java.source.parsing.FileObjects;
67
import org.netbeans.modules.java.source.parsing.FileObjects;
68
import org.netbeans.modules.java.source.parsing.JavacParser;
68
import org.netbeans.modules.java.source.parsing.JavacParser;
69
import org.netbeans.modules.java.source.usages.Pair;
70
import org.netbeans.modules.parsing.api.Embedding;
69
import org.netbeans.modules.parsing.api.Embedding;
71
import org.netbeans.modules.parsing.api.ParserManager;
70
import org.netbeans.modules.parsing.api.ParserManager;
72
import org.netbeans.modules.parsing.api.ResultIterator;
71
import org.netbeans.modules.parsing.api.ResultIterator;
Lines 76-81 Link Here
76
import org.netbeans.modules.parsing.spi.ParseException;
75
import org.netbeans.modules.parsing.spi.ParseException;
77
import org.netbeans.modules.parsing.spi.Parser;
76
import org.netbeans.modules.parsing.spi.Parser;
78
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
77
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
78
import org.openide.util.Pair;
79
79
80
/**
80
/**
81
 *
81
 *
Lines 3867-3873 Link Here
3867
                            tokenText = javadocTokens.token().text().toString();
3867
                            tokenText = javadocTokens.token().text().toString();
3868
                            if (tokenText.endsWith(">")) { //NOI18N
3868
                            if (tokenText.endsWith(">")) { //NOI18N
3869
                                if (P_TAG.equalsIgnoreCase(tokenText)) {
3869
                                if (P_TAG.equalsIgnoreCase(tokenText)) {
3870
                                    if (currWSOffset >= 0 && (toAdd == null || toAdd.first < currWSOffset)) {
3870
                                    if (currWSOffset >= 0 && (toAdd == null || toAdd.first() < currWSOffset)) {
3871
                                        marks.add(Pair.of(currWSOffset, 1));
3871
                                        marks.add(Pair.of(currWSOffset, 1));
3872
                                    }
3872
                                    }
3873
                                    lastAddedNLOffset = javadocTokens.offset() + javadocTokens.token().length() - offset;
3873
                                    lastAddedNLOffset = javadocTokens.offset() + javadocTokens.token().length() - offset;
Lines 3875-3881 Link Here
3875
                                    afterText = false;
3875
                                    afterText = false;
3876
                                } else if (PRE_TAG.equalsIgnoreCase(tokenText)
3876
                                } else if (PRE_TAG.equalsIgnoreCase(tokenText)
3877
                                        || CODE_TAG.equalsIgnoreCase(tokenText)) {
3877
                                        || CODE_TAG.equalsIgnoreCase(tokenText)) {
3878
                                    if (currWSOffset >= 0 && state == 0 && (toAdd == null || toAdd.first < currWSOffset)) {
3878
                                    if (currWSOffset >= 0 && state == 0 && (toAdd == null || toAdd.first() < currWSOffset)) {
3879
                                        marks.add(Pair.of(currWSOffset, 1));
3879
                                        marks.add(Pair.of(currWSOffset, 1));
3880
                                    }
3880
                                    }
3881
                                    marks.add(Pair.of(javadocTokens.offset() - offset, 5));
3881
                                    marks.add(Pair.of(javadocTokens.offset() - offset, 5));
Lines 3884-3890 Link Here
3884
                                    marks.add(Pair.of(currWSOffset >= 0 ? currWSOffset : javadocTokens.offset() - offset, 6));
3884
                                    marks.add(Pair.of(currWSOffset >= 0 ? currWSOffset : javadocTokens.offset() - offset, 6));
3885
                                } else {
3885
                                } else {
3886
                                    if (currWSOffset >= 0 && lastNLOffset >= currWSOffset
3886
                                    if (currWSOffset >= 0 && lastNLOffset >= currWSOffset
3887
                                            && lastAddedNLOffset < currWSOffset && (toAdd == null || toAdd.first < currWSOffset)) {
3887
                                            && lastAddedNLOffset < currWSOffset && (toAdd == null || toAdd.first() < currWSOffset)) {
3888
                                        marks.add(Pair.of(currWSOffset, 1));
3888
                                        marks.add(Pair.of(currWSOffset, 1));
3889
                                    }
3889
                                    }
3890
                                    nlAdd = Pair.of(javadocTokens.offset() + javadocTokens.token().length() - offset, 1);
3890
                                    nlAdd = Pair.of(javadocTokens.offset() + javadocTokens.token().length() - offset, 1);
Lines 4001-4008 Link Here
4001
            Iterator<Pair<Integer, Integer>> it = marks.iterator();
4001
            Iterator<Pair<Integer, Integer>> it = marks.iterator();
4002
            if (it.hasNext()) {
4002
            if (it.hasNext()) {
4003
                Pair<Integer, Integer> next = it.next();
4003
                Pair<Integer, Integer> next = it.next();
4004
                checkOffset = next.first;
4004
                checkOffset = next.first();
4005
                actionType = next.second;
4005
                actionType = next.second();
4006
            } else {
4006
            } else {
4007
                checkOffset = Integer.MAX_VALUE;
4007
                checkOffset = Integer.MAX_VALUE;
4008
                actionType = -1;
4008
                actionType = -1;
Lines 4089-4096 Link Here
4089
                        align = -1;
4089
                        align = -1;
4090
                        if (it.hasNext()) {
4090
                        if (it.hasNext()) {
4091
                            Pair<Integer, Integer> next = it.next();
4091
                            Pair<Integer, Integer> next = it.next();
4092
                            checkOffset = next.first;
4092
                            checkOffset = next.first();
4093
                            actionType = next.second;
4093
                            actionType = next.second();
4094
                        } else {
4094
                        } else {
4095
                            checkOffset = Integer.MAX_VALUE;
4095
                            checkOffset = Integer.MAX_VALUE;
4096
                            actionType = -1;
4096
                            actionType = -1;
Lines 4162-4169 Link Here
4162
                            }
4162
                            }
4163
                            if (it.hasNext()) {
4163
                            if (it.hasNext()) {
4164
                                Pair<Integer, Integer> next = it.next();
4164
                                Pair<Integer, Integer> next = it.next();
4165
                                checkOffset = next.first;
4165
                                checkOffset = next.first();
4166
                                actionType = next.second;
4166
                                actionType = next.second();
4167
                            } else {
4167
                            } else {
4168
                                checkOffset = Integer.MAX_VALUE;
4168
                                checkOffset = Integer.MAX_VALUE;
4169
                                actionType = -1;
4169
                                actionType = -1;
(-)a/java.source/src/org/netbeans/modules/java/source/usages/BinaryAnalyser.java (-19 / +20 lines)
Lines 114-119 Link Here
114
import org.openide.filesystems.FileUtil;
114
import org.openide.filesystems.FileUtil;
115
import org.openide.filesystems.URLMapper;
115
import org.openide.filesystems.URLMapper;
116
import org.openide.util.Exceptions;
116
import org.openide.util.Exceptions;
117
import org.openide.util.Pair;
117
import org.openide.util.Parameters;
118
import org.openide.util.Parameters;
118
import org.openide.util.Utilities;
119
import org.openide.util.Utilities;
119
120
Lines 330-338 Link Here
330
            final PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file),"UTF-8"));   //NOI18N
331
            final PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file),"UTF-8"));   //NOI18N
331
            try {
332
            try {
332
                for (Pair<ElementHandle<TypeElement>,Long> pair : state) {
333
                for (Pair<ElementHandle<TypeElement>,Long> pair : state) {
333
                    StringBuilder sb = new StringBuilder(pair.first.getBinaryName());
334
                    StringBuilder sb = new StringBuilder(pair.first().getBinaryName());
334
                    sb.append('='); //NOI18N
335
                    sb.append('='); //NOI18N
335
                    sb.append(pair.second.longValue());
336
                    sb.append(pair.second().longValue());
336
                    out.println(sb.toString());
337
                    out.println(sb.toString());
337
                }
338
                }
338
            } finally {
339
            } finally {
Lines 375-385 Link Here
375
        if (timeStamps == null) {
376
        if (timeStamps == null) {
376
            f.delete();
377
            f.delete();
377
        } else {
378
        } else {
378
            timeStamps.first.keySet().removeAll(timeStamps.second);
379
            timeStamps.first().keySet().removeAll(timeStamps.second());
379
            final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f), "UTF-8")); //NOI18N
380
            final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f), "UTF-8")); //NOI18N
380
            try {
381
            try {
381
                // write data
382
                // write data
382
                for(LongHashMap.Entry<String> entry : timeStamps.first.entrySet()) {
383
                for(LongHashMap.Entry<String> entry : timeStamps.first().entrySet()) {
383
                    out.write(entry.getKey());
384
                    out.write(entry.getKey());
384
                    out.write('='); //NOI18N
385
                    out.write('='); //NOI18N
385
                    out.write(Long.toString(entry.getValue()));
386
                    out.write(Long.toString(entry.getValue()));
Lines 394-406 Link Here
394
    }
395
    }
395
396
396
    private boolean timeStampsEmpty() {
397
    private boolean timeStampsEmpty() {
397
        return timeStamps == null || timeStamps.second.isEmpty();
398
        return timeStamps == null || timeStamps.second().isEmpty();
398
    }
399
    }
399
400
400
    private boolean isUpToDate(final String resourceName, final long timeStamp) throws IOException {
401
    private boolean isUpToDate(final String resourceName, final long timeStamp) throws IOException {
401
        final Pair<LongHashMap<String>,Set<String>> ts = getTimeStamps();
402
        final Pair<LongHashMap<String>,Set<String>> ts = getTimeStamps();
402
        long oldTime = ts.first.put(resourceName,timeStamp);
403
        long oldTime = ts.first().put(resourceName,timeStamp);
403
        ts.second.remove(resourceName);
404
        ts.second().remove(resourceName);
404
        return oldTime == timeStamp;
405
        return oldTime == timeStamp;
405
    }
406
    }
406
407
Lines 424-456 Link Here
424
            if (newE == null) {
425
            if (newE == null) {
425
                newE = newIt.next();
426
                newE = newIt.next();
426
            }
427
            }
427
            int ni = oldE.first.getBinaryName().compareTo(newE.first.getBinaryName());
428
            int ni = oldE.first().getBinaryName().compareTo(newE.first().getBinaryName());
428
            if (ni == 0) {
429
            if (ni == 0) {
429
                if (oldE.second.longValue() == 0 || oldE.second.longValue() != newE.second.longValue()) {
430
                if (oldE.second().longValue() == 0 || oldE.second().longValue() != newE.second().longValue()) {
430
                    changed.add(oldE.first);
431
                    changed.add(oldE.first());
431
                }
432
                }
432
                oldE = newE = null;
433
                oldE = newE = null;
433
            }
434
            }
434
            else if (ni < 0) {
435
            else if (ni < 0) {
435
                removed.add(oldE.first);
436
                removed.add(oldE.first());
436
                oldE = null;
437
                oldE = null;
437
            }
438
            }
438
            else if (ni > 0) {
439
            else if (ni > 0) {
439
                added.add(newE.first);
440
                added.add(newE.first());
440
                newE = null;
441
                newE = null;
441
            }
442
            }
442
        }
443
        }
443
        if (oldE != null) {
444
        if (oldE != null) {
444
            removed.add(oldE.first);
445
            removed.add(oldE.first());
445
        }
446
        }
446
        while (oldIt.hasNext()) {
447
        while (oldIt.hasNext()) {
447
            removed.add(oldIt.next().first);
448
            removed.add(oldIt.next().first());
448
        }
449
        }
449
        if (newE != null) {
450
        if (newE != null) {
450
            added.add(newE.first);
451
            added.add(newE.first());
451
        }
452
        }
452
        while (newIt.hasNext()) {
453
        while (newIt.hasNext()) {
453
            added.add(newIt.next().first);
454
            added.add(newIt.next().first());
454
        }
455
        }
455
        return new Changes(true, added, removed, changed, preBuildArgs);
456
        return new Changes(true, added, removed, changed, preBuildArgs);
456
    }
457
    }
Lines 859-865 Link Here
859
                public int compare(
860
                public int compare(
860
                        final Pair<ElementHandle<TypeElement>,Long> o1,
861
                        final Pair<ElementHandle<TypeElement>,Long> o1,
861
                        final Pair<ElementHandle<TypeElement>,Long> o2) {
862
                        final Pair<ElementHandle<TypeElement>,Long> o2) {
862
                    return o1.first.getBinaryName().compareTo(o2.first.getBinaryName());
863
                    return o1.first().getBinaryName().compareTo(o2.first().getBinaryName());
863
                }
864
                }
864
            };
865
            };
865
866
Lines 1077-1083 Link Here
1077
                    return false;
1078
                    return false;
1078
                }
1079
                }
1079
            }
1080
            }
1080
            for (String deleted : getTimeStamps().second) {
1081
            for (String deleted : getTimeStamps().second()) {
1081
                delete(deleted);
1082
                delete(deleted);
1082
                markChanged();
1083
                markChanged();
1083
            }
1084
            }
Lines 1137-1143 Link Here
1137
        DeletedRootProcessor(@NonNull final Context ctx) throws IOException {
1138
        DeletedRootProcessor(@NonNull final Context ctx) throws IOException {
1138
            super(ctx);
1139
            super(ctx);
1139
            final Pair<LongHashMap<String>, Set<String>> ts = getTimeStamps();
1140
            final Pair<LongHashMap<String>, Set<String>> ts = getTimeStamps();
1140
            if (!ts.first.isEmpty()) {
1141
            if (!ts.first().isEmpty()) {
1141
                markChanged();
1142
                markChanged();
1142
            }
1143
            }
1143
        }
1144
        }
(-)a/java.source/src/org/netbeans/modules/java/source/usages/ClassIndexImpl.java (+1 lines)
Lines 67-72 Link Here
67
import org.netbeans.modules.parsing.lucene.support.Convertor;
67
import org.netbeans.modules.parsing.lucene.support.Convertor;
68
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileObject;
69
import org.openide.util.Exceptions;
69
import org.openide.util.Exceptions;
70
import org.openide.util.Pair;
70
import org.openide.util.Utilities;
71
import org.openide.util.Utilities;
71
72
72
/** Should probably final class with private constructor.
73
/** Should probably final class with private constructor.
(-)a/java.source/src/org/netbeans/modules/java/source/usages/ClassIndexManager.java (-4 / +5 lines)
Lines 61-66 Link Here
61
import org.netbeans.modules.java.source.indexing.TransactionContext;
61
import org.netbeans.modules.java.source.indexing.TransactionContext;
62
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
63
import org.openide.util.Exceptions;
63
import org.openide.util.Exceptions;
64
import org.openide.util.Pair;
64
65
65
/**
66
/**
66
 *
67
 *
Lines 106-119 Link Here
106
                        return;
107
                        return;
107
                    }
108
                    }
108
                    Pair<ClassIndexImpl,Boolean> pair = getClassIndex(root, beforeCreateAllowed, false);
109
                    Pair<ClassIndexImpl,Boolean> pair = getClassIndex(root, beforeCreateAllowed, false);
109
                    index[0] = pair.first;
110
                    index[0] = pair.first();
110
                    if (index[0] != null) {
111
                    if (index[0] != null) {
111
                        return;
112
                        return;
112
                    }
113
                    }
113
                    URL translatedRoot = AptCacheForSourceQuery.getSourceFolder(root);
114
                    URL translatedRoot = AptCacheForSourceQuery.getSourceFolder(root);
114
                    if (translatedRoot != null) {
115
                    if (translatedRoot != null) {
115
                        pair = getClassIndex(translatedRoot, beforeCreateAllowed, false);
116
                        pair = getClassIndex(translatedRoot, beforeCreateAllowed, false);
116
                        index[0] = pair.first;
117
                        index[0] = pair.first();
117
                        if (index[0] != null) {
118
                        if (index[0] != null) {
118
                            return;
119
                            return;
119
                        }
120
                        }
Lines 170-176 Link Here
170
                return null;
171
                return null;
171
            }
172
            }
172
            Pair<ClassIndexImpl,Boolean> pair = getClassIndex (root, true, true);
173
            Pair<ClassIndexImpl,Boolean> pair = getClassIndex (root, true, true);
173
            ClassIndexImpl qi = pair.first;
174
            ClassIndexImpl qi = pair.first();
174
            if (qi == null) {
175
            if (qi == null) {
175
                qi = getUsagesQuery(root, true);
176
                qi = getUsagesQuery(root, true);
176
                if (qi == null) {
177
                if (qi == null) {
Lines 194-200 Link Here
194
                this.instances.put(root,qi);
195
                this.instances.put(root,qi);
195
                this.transientInstances.remove(root);
196
                this.transientInstances.remove(root);
196
                markAddedRoot(root);
197
                markAddedRoot(root);
197
            } else if (pair.second) {
198
            } else if (pair.second()) {
198
                markAddedRoot(root);
199
                markAddedRoot(root);
199
            }
200
            }
200
            return qi;
201
            return qi;
(-)a/java.source/src/org/netbeans/modules/java/source/usages/DocumentUtil.java (-8 / +9 lines)
Lines 77-82 Link Here
77
import org.netbeans.modules.parsing.lucene.support.Queries;
77
import org.netbeans.modules.parsing.lucene.support.Queries;
78
import org.openide.filesystems.FileObject;
78
import org.openide.filesystems.FileObject;
79
import org.openide.util.Exceptions;
79
import org.openide.util.Exceptions;
80
import org.openide.util.Pair;
80
81
81
/**
82
/**
82
 *
83
 *
Lines 529-538 Link Here
529
    private static class DocumentConvertor implements Convertor<Pair<Pair<String,String>,Object[]>,Document> {
530
    private static class DocumentConvertor implements Convertor<Pair<Pair<String,String>,Object[]>,Document> {
530
        @Override
531
        @Override
531
        public Document convert(Pair<Pair<String, String>, Object[]> entry) {
532
        public Document convert(Pair<Pair<String, String>, Object[]> entry) {
532
            final Pair<String,String> pair = entry.first;
533
            final Pair<String,String> pair = entry.first();
533
            final String cn = pair.first;
534
            final String cn = pair.first();
534
            final String srcName = pair.second;
535
            final String srcName = pair.second();
535
            final Object[] data = entry.second;
536
            final Object[] data = entry.second();
536
            final List<String> cr = (List<String>) data[0];
537
            final List<String> cr = (List<String>) data[0];
537
            final String fids = (String) data[1];
538
            final String fids = (String) data[1];
538
            final String ids = (String) data[2];
539
            final String ids = (String) data[2];
Lines 550-557 Link Here
550
551
551
        @Override
552
        @Override
552
        public Query convert(Pair<String, String> p) {
553
        public Query convert(Pair<String, String> p) {
553
            final String resourceName = p.first;
554
            final String resourceName = p.first();
554
            final String sourceName = p.second;
555
            final String sourceName = p.second();
555
            return fileBased ? createClassesInFileQuery(resourceName,sourceName) : createClassWithEnclosedQuery(resourceName, sourceName);
556
            return fileBased ? createClassesInFileQuery(resourceName,sourceName) : createClassWithEnclosedQuery(resourceName, sourceName);
556
        }
557
        }
557
        
558
        
Lines 613-620 Link Here
613
        
614
        
614
        private static Query binaryNameSourceNamePairQuery (final Pair<String,String> binaryNameSourceNamePair) {
615
        private static Query binaryNameSourceNamePairQuery (final Pair<String,String> binaryNameSourceNamePair) {
615
            assert binaryNameSourceNamePair != null;
616
            assert binaryNameSourceNamePair != null;
616
            final String binaryName = binaryNameSourceNamePair.first;
617
            final String binaryName = binaryNameSourceNamePair.first();
617
            final String sourceName = binaryNameSourceNamePair.second;
618
            final String sourceName = binaryNameSourceNamePair.second();
618
            final Query query = binaryNameQuery(binaryName);
619
            final Query query = binaryNameQuery(binaryName);
619
            if (sourceName != null) {
620
            if (sourceName != null) {
620
                assert query instanceof BooleanQuery : "The DocumentUtil.binaryNameQuery was incompatibly changed!";        //NOI18N
621
                assert query instanceof BooleanQuery : "The DocumentUtil.binaryNameQuery was incompatibly changed!";        //NOI18N
(-)a/java.source/src/org/netbeans/modules/java/source/usages/Pair.java (-75 lines)
Lines 1-75 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * Portions Copyrighted 2007 Sun Microsystems, Inc.
30
 */
31
package org.netbeans.modules.java.source.usages;
32
33
/**
34
 *
35
 * @author Tomas Zezula
36
 */
37
public final class Pair<P,K> {
38
39
    public final P first;
40
    public final K second;
41
42
    private Pair (P first, K second) {
43
        this.first = first;
44
        this.second = second;
45
    }
46
47
    
48
    public static <P,K> Pair<P,K> of (P first, K second) {
49
        return new Pair<P,K> (first,second);
50
    }
51
    
52
    
53
    @Override
54
    public int hashCode () {
55
        int hashCode  = 0;
56
        hashCode ^= first == null ? 0 : first.hashCode();
57
        hashCode ^= second == null ? 0: second.hashCode();
58
        return hashCode;
59
    }
60
    
61
    @Override
62
    public boolean equals (final Object other) {
63
        if (other instanceof Pair) {
64
            Pair otherPair = (Pair) other;
65
            return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) &&
66
                   (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second));
67
        }
68
        return false;
69
    }
70
    
71
    @Override
72
    public String toString () {
73
        return String.format("Pair[%s,%s]", first,second);
74
    }
75
}
(-)a/java.source/src/org/netbeans/modules/java/source/usages/PersistentClassIndex.java (-15 / +16 lines)
Lines 79-84 Link Here
79
import org.openide.filesystems.FileUtil;
79
import org.openide.filesystems.FileUtil;
80
import org.openide.filesystems.URLMapper;
80
import org.openide.filesystems.URLMapper;
81
import org.openide.util.Exceptions;
81
import org.openide.util.Exceptions;
82
import org.openide.util.Pair;
82
import org.openide.util.Parameters;
83
import org.openide.util.Parameters;
83
84
84
/**
85
/**
Lines 213-221 Link Here
213
                                QueryUtil.createPackageUsagesQuery(binaryName,usageType,Occur.SHOULD),
214
                                QueryUtil.createPackageUsagesQuery(binaryName,usageType,Occur.SHOULD),
214
                                scope);
215
                                scope);
215
                        if (q!=null) {
216
                        if (q!=null) {
216
                            index.query(result, ctu.first, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), q);
217
                            index.query(result, ctu.first(), DocumentUtil.declaredTypesFieldSelector(), cancel.get(), q);
217
                            if (ctu.second != null) {
218
                            if (ctu.second() != null) {
218
                                ctu.second.query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), q);
219
                                ctu.second().query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), q);
219
                            }
220
                            }
220
                        }
221
                        }
221
                        return null;
222
                        return null;
Lines 239-247 Link Here
239
                                    QueryUtil.createUsagesQuery(binaryName, usageType, Occur.SHOULD),
240
                                    QueryUtil.createUsagesQuery(binaryName, usageType, Occur.SHOULD),
240
                                    scope);
241
                                    scope);
241
                            if (usagesQuery != null) {
242
                            if (usagesQuery != null) {
242
                                index.query(result, ctu.first, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), usagesQuery);
243
                                index.query(result, ctu.first(), DocumentUtil.declaredTypesFieldSelector(), cancel.get(), usagesQuery);
243
                                if (ctu.second != null) {
244
                                if (ctu.second() != null) {
244
                                    ctu.second.query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), usagesQuery);
245
                                    ctu.second().query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), usagesQuery);
245
                                }
246
                                }
246
                            }
247
                            }
247
                            return null;
248
                            return null;
Lines 277-285 Link Here
277
                            DocumentUtil.translateQueryKind(kind)),
278
                            DocumentUtil.translateQueryKind(kind)),
278
                        scope);
279
                        scope);
279
                    if (query != null) {
280
                    if (query != null) {
280
                        index.query(result, ctu.first, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query);
281
                        index.query(result, ctu.first(), DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query);
281
                        if (ctu.second != null) {
282
                        if (ctu.second() != null) {
282
                            ctu.second.query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query);
283
                            ctu.second().query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query);
283
                        }
284
                        }
284
                    }
285
                    }
285
                    return null;
286
                    return null;
Lines 315-327 Link Here
315
                        };
316
                        };
316
                    index.queryDocTerms(
317
                    index.queryDocTerms(
317
                            result,
318
                            result,
318
                            ctu.first,
319
                            ctu.first(),
319
                            t2s,
320
                            t2s,
320
                            DocumentUtil.declaredTypesFieldSelector(),
321
                            DocumentUtil.declaredTypesFieldSelector(),
321
                            cancel.get(),
322
                            cancel.get(),
322
                            query);
323
                            query);
323
                    if (ctu.second != null) {
324
                    if (ctu.second() != null) {
324
                        ctu.second.queryDocTerms(
325
                        ctu.second().queryDocTerms(
325
                            result,
326
                            result,
326
                            convertor,
327
                            convertor,
327
                            t2s,
328
                            t2s,
Lines 360-366 Link Here
360
                        collectInto = result;
361
                        collectInto = result;
361
                    }
362
                    }
362
                    final Pair<StoppableConvertor<Term,String>,Term> filter = QueryUtil.createPackageFilter(prefix,directOnly);
363
                    final Pair<StoppableConvertor<Term,String>,Term> filter = QueryUtil.createPackageFilter(prefix,directOnly);
363
                    index.queryTerms(collectInto, filter.second, filter.first, cancel.get());
364
                    index.queryTerms(collectInto, filter.second(), filter.first(), cancel.get());
364
                    if (cacheOp) {
365
                    if (cacheOp) {
365
                        synchronized (PersistentClassIndex.this) {
366
                        synchronized (PersistentClassIndex.this) {
366
                            if (rootPkgCache == null) {
367
                            if (rootPkgCache == null) {
Lines 543-550 Link Here
543
                final Pair<Index,Set<String>> data = updateDirty();
544
                final Pair<Index,Set<String>> data = updateDirty();
544
                if (data != null) {
545
                if (data != null) {
545
                    return Pair.<Convertor<? super Document, T>,Index>of(
546
                    return Pair.<Convertor<? super Document, T>,Index>of(
546
                            new FilterConvertor<T>(data.second, delegate),
547
                            new FilterConvertor<T>(data.second(), delegate),
547
                            data.first);
548
                            data.first());
548
                }
549
                }
549
            } catch (IOException ioe) {
550
            } catch (IOException ioe) {
550
                Exceptions.printStackTrace(ioe);
551
                Exceptions.printStackTrace(ioe);
(-)a/java.source/src/org/netbeans/modules/java/source/usages/QueryUtil.java (+1 lines)
Lines 59-64 Link Here
59
import org.netbeans.modules.java.source.usages.ClassIndexImpl.UsageType;
59
import org.netbeans.modules.java.source.usages.ClassIndexImpl.UsageType;
60
import org.netbeans.modules.parsing.lucene.support.Queries;
60
import org.netbeans.modules.parsing.lucene.support.Queries;
61
import org.netbeans.modules.parsing.lucene.support.StoppableConvertor;
61
import org.netbeans.modules.parsing.lucene.support.StoppableConvertor;
62
import org.openide.util.Pair;
62
import org.openide.util.Parameters;
63
import org.openide.util.Parameters;
63
64
64
/**
65
/**
(-)a/java.source/src/org/netbeans/modules/java/source/usages/SourceAnalyzerFactory.java (-5 / +6 lines)
Lines 85-90 Link Here
85
import org.openide.filesystems.FileUtil;
85
import org.openide.filesystems.FileUtil;
86
import org.openide.filesystems.URLMapper;
86
import org.openide.filesystems.URLMapper;
87
import org.openide.util.Exceptions;
87
import org.openide.util.Exceptions;
88
import org.openide.util.Pair;
88
import org.openide.util.Parameters;
89
import org.openide.util.Parameters;
89
90
90
/**
91
/**
Lines 443-449 Link Here
443
                    final String classNameType = className + DocumentUtil.encodeKind(ElementKind.CLASS);
444
                    final String classNameType = className + DocumentUtil.encodeKind(ElementKind.CLASS);
444
                    final Pair<String,String> name = Pair.<String,String>of(classNameType, null);
445
                    final Pair<String,String> name = Pair.<String,String>of(classNameType, null);
445
                    for (Pair<Symbol,ClassIndexImpl.UsageType> usage : packageAnnotations) {
446
                    for (Pair<Symbol,ClassIndexImpl.UsageType> usage : packageAnnotations) {
446
                        addUsage(usage.first, name, p, usage.second);
447
                        addUsage(usage.first(), name, p, usage.second());
447
                    }
448
                    }
448
                    for (CharSequence ident : packageAnnotationIdents) {
449
                    for (CharSequence ident : packageAnnotationIdents) {
449
                        addIdent(name, ident, p, false);
450
                        addIdent(name, ident, p, false);
Lines 641-647 Link Here
641
                                crossedTopLevel = true;
642
                                crossedTopLevel = true;
642
                            }
643
                            }
643
                        } else {
644
                        } else {
644
                            resourceName = activeClass.peek().second;
645
                            resourceName = activeClass.peek().second();
645
                        }
646
                        }
646
                        name = Pair.<String,String>of(classNameType, resourceName);
647
                        name = Pair.<String,String>of(classNameType, resourceName);
647
                        nameFrom = 2;
648
                        nameFrom = 2;
Lines 663-669 Link Here
663
                if (className != null) {
664
                if (className != null) {
664
                    if (topLevel) {
665
                    if (topLevel) {
665
                        if (topLevels != null) {
666
                        if (topLevels != null) {
666
                            topLevels.add (Pair.<String,String>of(className, name.second));
667
                            topLevels.add (Pair.<String,String>of(className, name.second()));
667
                        }
668
                        }
668
                        try {
669
                        try {
669
                            addAndClearImports(name, p);
670
                            addAndClearImports(name, p);
Lines 937-944 Link Here
937
        private UsagesData<String> getData (@NonNull final Pair<String,String>owner, @NonNull final Map<Pair<String,String>, UsagesData<String>> map) {
938
        private UsagesData<String> getData (@NonNull final Pair<String,String>owner, @NonNull final Map<Pair<String,String>, UsagesData<String>> map) {
938
            UsagesData<String> data = map.get(owner);
939
            UsagesData<String> data = map.get(owner);
939
            if (data == null) {
940
            if (data == null) {
940
                if (owner.first.charAt(owner.first.length()-2) == '.') {    //NOI18N
941
                if (owner.first().charAt(owner.first().length()-2) == '.') {    //NOI18N
941
                    throw new IllegalArgumentException(owner.first);
942
                    throw new IllegalArgumentException(owner.first());
942
                }
943
                }
943
                data = new UsagesData<String> (CONVERTOR);
944
                data = new UsagesData<String> (CONVERTOR);
944
                map.put(owner,data);
945
                map.put(owner,data);
(-)a/java.source/src/org/netbeans/modules/java/source/usages/VirtualSourceProviderQuery.java (-3 / +4 lines)
Lines 62-67 Link Here
62
import org.openide.util.Lookup;
62
import org.openide.util.Lookup;
63
import org.openide.util.LookupEvent;
63
import org.openide.util.LookupEvent;
64
import org.openide.util.LookupListener;
64
import org.openide.util.LookupListener;
65
import org.openide.util.Pair;
65
import org.openide.util.Parameters;
66
import org.openide.util.Parameters;
66
import org.openide.util.Utilities;
67
import org.openide.util.Utilities;
67
import org.openide.util.WeakListeners;
68
import org.openide.util.WeakListeners;
Lines 131-137 Link Here
131
                   m.put(ext, Pair.of(prov, l));
132
                   m.put(ext, Pair.of(prov, l));
132
               }
133
               }
133
               else {
134
               else {
134
                   l = p.second;
135
                   l = p.second();
135
               }
136
               }
136
               try {
137
               try {
137
                   final File file = Utilities.toFile(indexable.getURL().toURI());
138
                   final File file = Utilities.toFile(indexable.getURL().toURI());
Lines 147-154 Link Here
147
        
148
        
148
        final R r = new R (root, file2indexables);
149
        final R r = new R (root, file2indexables);
149
        for (Pair<VirtualSourceProvider,List<File>> p : m.values()) {
150
        for (Pair<VirtualSourceProvider,List<File>> p : m.values()) {
150
            final VirtualSourceProvider prov = p.first;
151
            final VirtualSourceProvider prov = p.first();
151
            final List<File> tf = p.second;
152
            final List<File> tf = p.second();
152
            r.setProvider(prov);
153
            r.setProvider(prov);
153
            prov.translate(tf, root,r);
154
            prov.translate(tf, root,r);
154
        }
155
        }
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/JavaSourceTest.java (-1 / +1 lines)
Lines 106-112 Link Here
106
import org.netbeans.modules.java.source.parsing.DocPositionRegion;
106
import org.netbeans.modules.java.source.parsing.DocPositionRegion;
107
import org.netbeans.modules.java.source.parsing.JavaFileObjectProvider;
107
import org.netbeans.modules.java.source.parsing.JavaFileObjectProvider;
108
import org.netbeans.modules.java.source.parsing.SourceFileObject;
108
import org.netbeans.modules.java.source.parsing.SourceFileObject;
109
import org.netbeans.modules.java.source.usages.Pair;
110
import org.netbeans.modules.parsing.lucene.IndexFactory;
109
import org.netbeans.modules.parsing.lucene.IndexFactory;
111
import org.netbeans.modules.parsing.lucene.support.Convertor;
110
import org.netbeans.modules.parsing.lucene.support.Convertor;
112
import org.netbeans.modules.parsing.lucene.support.Index;
111
import org.netbeans.modules.parsing.lucene.support.Index;
Lines 140-145 Link Here
140
import org.netbeans.modules.parsing.spi.TaskIndexingMode;
139
import org.netbeans.modules.parsing.spi.TaskIndexingMode;
141
import org.netbeans.spi.java.classpath.ClassPathProvider;
140
import org.netbeans.spi.java.classpath.ClassPathProvider;
142
import org.openide.util.Exceptions;
141
import org.openide.util.Exceptions;
142
import org.openide.util.Pair;
143
/**
143
/**
144
 *
144
 *
145
 * @author Tomas Zezula
145
 * @author Tomas Zezula
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/support/ProfileSupportTest.java (-4 / +4 lines)
Lines 78-88 Link Here
78
import org.netbeans.modules.java.platform.JavaPlatformProvider;
78
import org.netbeans.modules.java.platform.JavaPlatformProvider;
79
import org.netbeans.modules.java.source.ElementHandleAccessor;
79
import org.netbeans.modules.java.source.ElementHandleAccessor;
80
import org.netbeans.modules.java.source.parsing.FileObjects;
80
import org.netbeans.modules.java.source.parsing.FileObjects;
81
import org.netbeans.modules.java.source.usages.Pair;
82
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
81
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
83
import org.openide.filesystems.FileObject;
82
import org.openide.filesystems.FileObject;
84
import org.openide.filesystems.FileUtil;
83
import org.openide.filesystems.FileUtil;
85
import org.openide.modules.SpecificationVersion;
84
import org.openide.modules.SpecificationVersion;
85
import org.openide.util.Pair;
86
import org.openide.util.Utilities;
86
import org.openide.util.Utilities;
87
87
88
/**
88
/**
Lines 214-220 Link Here
214
                public int compare(
214
                public int compare(
215
                        Pair<ElementHandle<TypeElement>, SourceLevelQuery.Profile> o1,
215
                        Pair<ElementHandle<TypeElement>, SourceLevelQuery.Profile> o1,
216
                        Pair<ElementHandle<TypeElement>, SourceLevelQuery.Profile> o2) {
216
                        Pair<ElementHandle<TypeElement>, SourceLevelQuery.Profile> o2) {
217
                    return o1.first.getBinaryName().compareTo(o2.first.getBinaryName());
217
                    return o1.first().getBinaryName().compareTo(o2.first().getBinaryName());
218
                }
218
                }
219
            });
219
            });
220
        }
220
        }
Lines 352-359 Link Here
352
352
353
353
354
            JP(Pair<File,URL> p) {
354
            JP(Pair<File,URL> p) {
355
                this.home = FileUtil.toFileObject(p.first);
355
                this.home = FileUtil.toFileObject(p.first());
356
                this.boot = ClassPathSupport.createClassPath(p.second);
356
                this.boot = ClassPathSupport.createClassPath(p.second());
357
            }
357
            }
358
358
359
359
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/parsing/CachingFileManagerTest.java (-8 / +8 lines)
Lines 58-66 Link Here
58
import javax.tools.StandardLocation;
58
import javax.tools.StandardLocation;
59
import org.netbeans.api.java.classpath.ClassPath;
59
import org.netbeans.api.java.classpath.ClassPath;
60
import org.netbeans.junit.NbTestCase;
60
import org.netbeans.junit.NbTestCase;
61
import org.netbeans.modules.java.source.usages.Pair;
62
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
61
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
63
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
63
import org.openide.util.Pair;
64
import org.openide.util.Utilities;
64
import org.openide.util.Utilities;
65
65
66
/**
66
/**
Lines 120-139 Link Here
120
        final CachingArchiveProvider provider = CachingArchiveProvider.getDefault();
120
        final CachingArchiveProvider provider = CachingArchiveProvider.getDefault();
121
        final CachingFileManager manager = new CachingFileManager(provider, cp, false, true);
121
        final CachingFileManager manager = new CachingFileManager(provider, cp, false, true);
122
        for (Pair<Pair<String,String>,URI> testCase : testCases) {
122
        for (Pair<Pair<String,String>,URI> testCase : testCases) {
123
            final Pair<String,String> name = testCase.first;
123
            final Pair<String,String> name = testCase.first();
124
            final URI expectedURI = testCase.second;
124
            final URI expectedURI = testCase.second();
125
            FileObject fo = manager.getFileForInput(StandardLocation.CLASS_PATH, name.first, name.second);
125
            FileObject fo = manager.getFileForInput(StandardLocation.CLASS_PATH, name.first(), name.second());
126
            if (expectedURI == null) {
126
            if (expectedURI == null) {
127
                assertNull(
127
                assertNull(
128
                    String.format("Lookup: %s/%s expected: null",
128
                    String.format("Lookup: %s/%s expected: null",
129
                    name.first,
129
                    name.first(),
130
                    name.second),
130
                    name.second()),
131
                    fo);
131
                    fo);
132
            } else {
132
            } else {
133
                assertEquals(
133
                assertEquals(
134
                    String.format("Lookup: %s/%s expected: %s",
134
                    String.format("Lookup: %s/%s expected: %s",
135
                    name.first,
135
                    name.first(),
136
                    name.second,
136
                    name.second(),
137
                    expectedURI),
137
                    expectedURI),
138
                    expectedURI,
138
                    expectedURI,
139
                    fo.toUri());
139
                    fo.toUri());
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/usages/BinaryAnalyserTest.java (+1 lines)
Lines 76-81 Link Here
76
import org.openide.filesystems.FileObject;
76
import org.openide.filesystems.FileObject;
77
import org.openide.filesystems.FileUtil;
77
import org.openide.filesystems.FileUtil;
78
import org.openide.util.Exceptions;
78
import org.openide.util.Exceptions;
79
import org.openide.util.Pair;
79
import org.openide.util.Utilities;
80
import org.openide.util.Utilities;
80
81
81
/**
82
/**
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/usages/LucenePerformanceTest.java (-1 / +2 lines)
Lines 71-76 Link Here
71
import org.netbeans.modules.parsing.lucene.support.IndexManagerTestUtilities;
71
import org.netbeans.modules.parsing.lucene.support.IndexManagerTestUtilities;
72
import org.netbeans.modules.parsing.lucene.support.Queries;
72
import org.netbeans.modules.parsing.lucene.support.Queries;
73
import org.netbeans.modules.parsing.lucene.support.StoppableConvertor;
73
import org.netbeans.modules.parsing.lucene.support.StoppableConvertor;
74
import org.openide.util.Pair;
74
75
75
/**
76
/**
76
 *
77
 *
Lines 115-121 Link Here
115
        Set<String> result = new HashSet<String>();
116
        Set<String> result = new HashSet<String>();
116
        startTime = System.currentTimeMillis();
117
        startTime = System.currentTimeMillis();
117
        final Pair<StoppableConvertor<Term,String>,Term> filter = QueryUtil.createPackageFilter("", true);
118
        final Pair<StoppableConvertor<Term,String>,Term> filter = QueryUtil.createPackageFilter("", true);
118
        index.queryTerms(result, filter.second, filter.first, null);
119
        index.queryTerms(result, filter.second(), filter.first(), null);
119
        endTime = System.currentTimeMillis();
120
        endTime = System.currentTimeMillis();
120
        delta = (endTime-startTime);
121
        delta = (endTime-startTime);
121
        System.out.println("Packages: " + delta);
122
        System.out.println("Packages: " + delta);
(-)a/java.sourceui/nbproject/project.xml (-1 / +1 lines)
Lines 216-222 Link Here
216
                    <build-prerequisite/>
216
                    <build-prerequisite/>
217
                    <compile-dependency/>
217
                    <compile-dependency/>
218
                    <run-dependency>
218
                    <run-dependency>
219
                        <specification-version>8.0</specification-version>
219
                        <specification-version>8.32</specification-version>
220
                    </run-dependency>
220
                    </run-dependency>
221
                </dependency>
221
                </dependency>
222
                <dependency>
222
                <dependency>
(-)a/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java (-23 / +23 lines)
Lines 79-91 Link Here
79
import org.netbeans.modules.java.preprocessorbridge.api.JavaSourceUtil;
79
import org.netbeans.modules.java.preprocessorbridge.api.JavaSourceUtil;
80
import org.netbeans.modules.java.source.JavadocHelper;
80
import org.netbeans.modules.java.source.JavadocHelper;
81
import org.netbeans.modules.java.source.parsing.FileObjects;
81
import org.netbeans.modules.java.source.parsing.FileObjects;
82
import org.netbeans.modules.java.source.usages.Pair;
83
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
82
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
84
import org.openide.filesystems.FileObject;
83
import org.openide.filesystems.FileObject;
85
import org.openide.filesystems.FileStateInvalidException;
84
import org.openide.filesystems.FileStateInvalidException;
86
import org.openide.filesystems.FileUtil;
85
import org.openide.filesystems.FileUtil;
87
import org.openide.util.Exceptions;
86
import org.openide.util.Exceptions;
88
import org.openide.util.NbBundle;
87
import org.openide.util.NbBundle;
88
import org.openide.util.Pair;
89
import org.openide.util.RequestProcessor;
89
import org.openide.util.RequestProcessor;
90
import org.openide.xml.XMLUtil;
90
import org.openide.xml.XMLUtil;
91
91
Lines 344-350 Link Here
344
        this.cpInfo = compilationInfo.getClasspathInfo();
344
        this.cpInfo = compilationInfo.getClasspathInfo();
345
        this.handle = element == null ? null : ElementHandle.create(element);
345
        this.handle = element == null ? null : ElementHandle.create(element);
346
        this.cancel = cancel;
346
        this.cancel = cancel;
347
        Doc doc = context.second.javaDocFor(element);
347
        Doc doc = context.second().javaDocFor(element);
348
        boolean localized = false;
348
        boolean localized = false;
349
        StringBuilder content = new StringBuilder();
349
        StringBuilder content = new StringBuilder();
350
        JavadocHelper.TextStream page = null;
350
        JavadocHelper.TextStream page = null;
Lines 397-403 Link Here
397
                    c.toPhase(Phase.RESOLVED);
397
                    c.toPhase(Phase.RESOLVED);
398
                    final Element element = handle.resolve(c);
398
                    final Element element = handle.resolve(c);
399
                    Pair<Trees,ElementUtilities> context = Pair.of(c.getTrees(), c.getElementUtilities());
399
                    Pair<Trees,ElementUtilities> context = Pair.of(c.getTrees(), c.getElementUtilities());
400
                    Doc doc = context.second.javaDocFor(element);
400
                    Doc doc = context.second().javaDocFor(element);
401
                    JavadocHelper.TextStream page = JavadocHelper.getJavadoc(element, cancel);
401
                    JavadocHelper.TextStream page = JavadocHelper.getJavadoc(element, cancel);
402
                    return prepareContent(contentFin, doc,localizedFin, page, cancel, false, context).get();
402
                    return prepareContent(contentFin, doc,localizedFin, page, cancel, false, context).get();
403
                }
403
                }
Lines 787-793 Link Here
787
        StringBuilder sb = new StringBuilder();
787
        StringBuilder sb = new StringBuilder();
788
        ClassDoc cls = peDoc.containingClass();
788
        ClassDoc cls = peDoc.containingClass();
789
        if (cls != null) {
789
        if (cls != null) {
790
            Element e = ctx.second.elementFor(cls);
790
            Element e = ctx.second().elementFor(cls);
791
            if (e != null) {
791
            if (e != null) {
792
                switch(e.getEnclosingElement().getKind()) {
792
                switch(e.getEnclosingElement().getKind()) {
793
                    case ANNOTATION_TYPE:
793
                    case ANNOTATION_TYPE:
Lines 806-812 Link Here
806
            PackageDoc pkg = peDoc.containingPackage();
806
            PackageDoc pkg = peDoc.containingPackage();
807
            if (pkg != null) {
807
            if (pkg != null) {
808
                sb.append("<font size='+0'><b>"); //NOI18N
808
                sb.append("<font size='+0'><b>"); //NOI18N
809
                createLink(sb, ctx.second.elementFor(pkg), makeNameLineBreakable(pkg.name()));
809
                createLink(sb, ctx.second().elementFor(pkg), makeNameLineBreakable(pkg.name()));
810
                sb.append("</b></font>"); //NOI18N)
810
                sb.append("</b></font>"); //NOI18N)
811
            }
811
            }
812
        }
812
        }
Lines 973-979 Link Here
973
                    sb.append('('); //NOI18N
973
                    sb.append('('); //NOI18N
974
                    for (int i = 0; i < pairs.length; i++) {
974
                    for (int i = 0; i < pairs.length; i++) {
975
                        AnnotationTypeElementDoc ated = pairs[i].element();
975
                        AnnotationTypeElementDoc ated = pairs[i].element();
976
                        createLink(sb, ctx.second.elementFor(ated), ated.name());
976
                        createLink(sb, ctx.second().elementFor(ated), ated.name());
977
                        sb.append('='); //NOI18N
977
                        sb.append('='); //NOI18N
978
                        appendAnnotationValue(sb, pairs[i].value(), ctx);
978
                        appendAnnotationValue(sb, pairs[i].value(), ctx);
979
                        if (i < pairs.length - 1)
979
                        if (i < pairs.length - 1)
Lines 1009-1015 Link Here
1009
            if (length > 1)
1009
            if (length > 1)
1010
                sb.append('}'); //NOI18N
1010
                sb.append('}'); //NOI18N
1011
        } else if (value instanceof Doc) {
1011
        } else if (value instanceof Doc) {
1012
            createLink(sb, ctx.second.elementFor((Doc)value), ((Doc)value).name());
1012
            createLink(sb, ctx.second().elementFor((Doc)value), ((Doc)value).name());
1013
        } else {
1013
        } else {
1014
            sb.append(value.toString());
1014
            sb.append(value.toString());
1015
        }
1015
        }
Lines 1061-1067 Link Here
1061
                thr.append("<code>"); //NOI18N
1061
                thr.append("<code>"); //NOI18N
1062
                Type exType = throwsTag.exceptionType();
1062
                Type exType = throwsTag.exceptionType();
1063
                if (exType != null) {
1063
                if (exType != null) {
1064
                    createLink(thr, ctx.second.elementFor(exType.asClassDoc()), exType.simpleTypeName());
1064
                    createLink(thr, ctx.second().elementFor(exType.asClassDoc()), exType.simpleTypeName());
1065
                } else {
1065
                } else {
1066
                    thr.append(throwsTag.exceptionName());
1066
                    thr.append(throwsTag.exceptionName());
1067
                }
1067
                }
Lines 1090-1096 Link Here
1090
                String label = stag.label();
1090
                String label = stag.label();
1091
                if (memberName != null) {
1091
                if (memberName != null) {
1092
                    if (refClass != null) {
1092
                    if (refClass != null) {
1093
                        createLink(see, ctx.second.elementFor(stag.referencedMember()), "<code>" + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + "</code>"); //NOI18N
1093
                        createLink(see, ctx.second().elementFor(stag.referencedMember()), "<code>" + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + "</code>"); //NOI18N
1094
                    } else {
1094
                    } else {
1095
                        see.append(className);
1095
                        see.append(className);
1096
                        see.append('.'); //NOI18N
1096
                        see.append('.'); //NOI18N
Lines 1099-1107 Link Here
1099
                    see.append(", "); //NOI18N
1099
                    see.append(", "); //NOI18N
1100
                } else if (className != null) {
1100
                } else if (className != null) {
1101
                    if (refClass != null) {
1101
                    if (refClass != null) {
1102
                        createLink(see, ctx.second.elementFor(refClass), "<code>" + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + "</code>"); //NOI18N
1102
                        createLink(see, ctx.second().elementFor(refClass), "<code>" + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + "</code>"); //NOI18N
1103
                    } else if (refPackage != null) {
1103
                    } else if (refPackage != null) {
1104
                        createLink(see, ctx.second.elementFor(refPackage), "<code>" + (label != null && label.length() > 0 ? label : refPackage.name()) + "</code>"); //NOI18N
1104
                        createLink(see, ctx.second().elementFor(refPackage), "<code>" + (label != null && label.length() > 0 ? label : refPackage.name()) + "</code>"); //NOI18N
1105
                    } else {
1105
                    } else {
1106
                        see.append(className);
1106
                        see.append(className);
1107
                    }
1107
                    }
Lines 1159-1165 Link Here
1159
                thr.append("<code>"); //NOI18N
1159
                thr.append("<code>"); //NOI18N
1160
                Type exType = ((ThrowsTag)tag).exceptionType();
1160
                Type exType = ((ThrowsTag)tag).exceptionType();
1161
                if (exType != null)
1161
                if (exType != null)
1162
                    createLink(thr, ctx.second.elementFor(exType.asClassDoc()), exType.simpleTypeName());
1162
                    createLink(thr, ctx.second().elementFor(exType.asClassDoc()), exType.simpleTypeName());
1163
                else
1163
                else
1164
                    thr.append(((ThrowsTag)tag).exceptionName());
1164
                    thr.append(((ThrowsTag)tag).exceptionName());
1165
                thr.append("</code>"); //NOI18N
1165
                thr.append("</code>"); //NOI18N
Lines 1181-1187 Link Here
1181
                String label = stag.label();
1181
                String label = stag.label();
1182
                if (memberName != null) {
1182
                if (memberName != null) {
1183
                    if (refClass != null) {
1183
                    if (refClass != null) {
1184
                        createLink(see, ctx.second.elementFor(stag.referencedMember()), "<code>" + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + "</code>"); //NOI18N
1184
                        createLink(see, ctx.second().elementFor(stag.referencedMember()), "<code>" + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + "</code>"); //NOI18N
1185
                    } else {
1185
                    } else {
1186
                        see.append(className);
1186
                        see.append(className);
1187
                        see.append('.'); //NOI18N
1187
                        see.append('.'); //NOI18N
Lines 1190-1198 Link Here
1190
                    see.append(", "); //NOI18N
1190
                    see.append(", "); //NOI18N
1191
                } else if (className != null) {
1191
                } else if (className != null) {
1192
                    if (refClass != null) {
1192
                    if (refClass != null) {
1193
                        createLink(see, ctx.second.elementFor(refClass), "<code>" + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + "</code>"); //NOI18N
1193
                        createLink(see, ctx.second().elementFor(refClass), "<code>" + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + "</code>"); //NOI18N
1194
                    } else if (refPackage != null) {
1194
                    } else if (refPackage != null) {
1195
                        createLink(see, ctx.second.elementFor(refPackage), "<code>" + (label != null && label.length() > 0 ? label : refPackage.name()) + "</code>"); //NOI18N
1195
                        createLink(see, ctx.second().elementFor(refPackage), "<code>" + (label != null && label.length() > 0 ? label : refPackage.name()) + "</code>"); //NOI18N
1196
                    } else {
1196
                    } else {
1197
                        see.append(className);
1197
                        see.append(className);
1198
                    }
1198
                    }
Lines 1262-1268 Link Here
1262
                    boolean plain = LINKPLAIN_TAG.equals(stag.name());
1262
                    boolean plain = LINKPLAIN_TAG.equals(stag.name());
1263
                    if (memberName != null) {
1263
                    if (memberName != null) {
1264
                        if (refClass != null) {
1264
                        if (refClass != null) {
1265
                            createLink(sb, ctx.second.elementFor(stag.referencedMember()), (plain ? "" : "<code>") + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + (plain ? "" : "</code>")); //NOI18N
1265
                            createLink(sb, ctx.second().elementFor(stag.referencedMember()), (plain ? "" : "<code>") + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + (plain ? "" : "</code>")); //NOI18N
1266
                        } else {
1266
                        } else {
1267
                            sb.append(stag.referencedClassName());
1267
                            sb.append(stag.referencedClassName());
1268
                            sb.append('.'); //NOI18N
1268
                            sb.append('.'); //NOI18N
Lines 1270-1278 Link Here
1270
                        }
1270
                        }
1271
                    } else {
1271
                    } else {
1272
                        if (refClass != null) {
1272
                        if (refClass != null) {
1273
                            createLink(sb, ctx.second.elementFor(refClass), (plain ? "" : "<code>") + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + (plain ? "" : "</code>")); //NOI18N
1273
                            createLink(sb, ctx.second().elementFor(refClass), (plain ? "" : "<code>") + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + (plain ? "" : "</code>")); //NOI18N
1274
                        } else if (refPackage != null) {
1274
                        } else if (refPackage != null) {
1275
                            createLink(sb, ctx.second.elementFor(refPackage), (plain ? "" : "<code>") + (label != null && label.length() > 0 ? label : refPackage.name()) + (plain ? "" : "</code>")); //NOI18N
1275
                            createLink(sb, ctx.second().elementFor(refPackage), (plain ? "" : "<code>") + (label != null && label.length() > 0 ? label : refPackage.name()) + (plain ? "" : "</code>")); //NOI18N
1276
                        } else {
1276
                        } else {
1277
                            String className = stag.referencedClassName();
1277
                            String className = stag.referencedClassName();
1278
                            sb.append(className != null ? className : stag.text());
1278
                            sb.append(className != null ? className : stag.text());
Lines 1383-1389 Link Here
1383
                String tName = cd != null ? cd.name() : type.simpleTypeName();
1383
                String tName = cd != null ? cd.name() : type.simpleTypeName();
1384
                if (cd != null && cd.isAnnotationType() && annotation)
1384
                if (cd != null && cd.isAnnotationType() && annotation)
1385
                    tName = "@" + tName; //NOI18N
1385
                    tName = "@" + tName; //NOI18N
1386
                len += createLink(sb, ctx.second.elementFor(type.asClassDoc()), tName);
1386
                len += createLink(sb, ctx.second().elementFor(type.asClassDoc()), tName);
1387
                ParameterizedType pt = type.asParameterizedType();
1387
                ParameterizedType pt = type.asParameterizedType();
1388
                if (pt != null) {
1388
                if (pt != null) {
1389
                    Type[] targs = pt.typeArguments();
1389
                    Type[] targs = pt.typeArguments();
Lines 1433-1439 Link Here
1433
            for (ClassDoc ifaceDoc : cdoc.interfaces()) {
1433
            for (ClassDoc ifaceDoc : cdoc.interfaces()) {
1434
                for (MethodDoc methodDoc : ifaceDoc.methods(false)) {
1434
                for (MethodDoc methodDoc : ifaceDoc.methods(false)) {
1435
                    if (mdoc.overrides(methodDoc)) {
1435
                    if (mdoc.overrides(methodDoc)) {
1436
                        Element e = ctx.second.elementFor(methodDoc);
1436
                        Element e = ctx.second().elementFor(methodDoc);
1437
                        boolean isLocalized = false;
1437
                        boolean isLocalized = false;
1438
                        if (e != null) {
1438
                        if (e != null) {
1439
                            inheritedPage = JavadocHelper.getJavadoc(e, cancel);
1439
                            inheritedPage = JavadocHelper.getJavadoc(e, cancel);
Lines 1441-1447 Link Here
1441
                                docURL = inheritedPage.getLocation();
1441
                                docURL = inheritedPage.getLocation();
1442
                            }
1442
                            }
1443
                            if (!(isLocalized = isLocalized(docURL, e)))
1443
                            if (!(isLocalized = isLocalized(docURL, e)))
1444
                                ctx.first.getTree(e);
1444
                                ctx.first().getTree(e);
1445
                        }
1445
                        }
1446
                        if (!isLocalized) {
1446
                        if (!isLocalized) {
1447
                            List<Tag> inheritedInlineTags = null;
1447
                            List<Tag> inheritedInlineTags = null;
Lines 1606-1612 Link Here
1606
            if (superclass != null) { //NOI18N
1606
            if (superclass != null) { //NOI18N
1607
                for (MethodDoc methodDoc : superclass.methods(false)) {
1607
                for (MethodDoc methodDoc : superclass.methods(false)) {
1608
                    if (mdoc.overrides(methodDoc)) {
1608
                    if (mdoc.overrides(methodDoc)) {
1609
                        Element e = ctx.second.elementFor(methodDoc);
1609
                        Element e = ctx.second().elementFor(methodDoc);
1610
                        boolean isLocalized = false;
1610
                        boolean isLocalized = false;
1611
                        if (e != null) {
1611
                        if (e != null) {
1612
                            inheritedPage = JavadocHelper.getJavadoc(e, cancel);
1612
                            inheritedPage = JavadocHelper.getJavadoc(e, cancel);
Lines 1614-1620 Link Here
1614
                                docURL = inheritedPage.getLocation();
1614
                                docURL = inheritedPage.getLocation();
1615
                            }
1615
                            }
1616
                            if (!(isLocalized = isLocalized(docURL, e)))
1616
                            if (!(isLocalized = isLocalized(docURL, e)))
1617
                                ctx.first.getTree(e);
1617
                                ctx.first().getTree(e);
1618
                        }
1618
                        }
1619
                        if (!isLocalized) {
1619
                        if (!isLocalized) {
1620
                            List<Tag> inheritedInlineTags = null;
1620
                            List<Tag> inheritedInlineTags = null;
(-)a/javascript.editing/nbproject/project.xml (-1 / +1 lines)
Lines 262-268 Link Here
262
                    <build-prerequisite/>
262
                    <build-prerequisite/>
263
                    <compile-dependency/>
263
                    <compile-dependency/>
264
                    <run-dependency>
264
                    <run-dependency>
265
                        <specification-version>8.0</specification-version>
265
                        <specification-version>8.32</specification-version>
266
                    </run-dependency>
266
                    </run-dependency>
267
                </dependency>
267
                </dependency>
268
                <dependency>
268
                <dependency>
(-)a/javascript.editing/src/org/netbeans/modules/javascript/editing/JsCodeCompletion.java (-6 / +7 lines)
Lines 99-104 Link Here
99
import org.openide.util.Exceptions;
99
import org.openide.util.Exceptions;
100
import org.openide.util.ImageUtilities;
100
import org.openide.util.ImageUtilities;
101
import org.openide.util.NbBundle;
101
import org.openide.util.NbBundle;
102
import org.openide.util.Pair;
102
103
103
/**
104
/**
104
 * Code completion handler for JavaScript
105
 * Code completion handler for JavaScript
Lines 1222-1229 Link Here
1222
            matches = index.getElements(prefix, fqn, kind, result);
1223
            matches = index.getElements(prefix, fqn, kind, result);
1223
        } else {
1224
        } else {
1224
            Pair<Set<IndexedElement>, Boolean> names = index.getAllNamesTruncated(prefix, kind, result);
1225
            Pair<Set<IndexedElement>, Boolean> names = index.getAllNamesTruncated(prefix, kind, result);
1225
            matches = names.getA();
1226
            matches = names.first();
1226
            boolean isTruncated = names.getB();
1227
            boolean isTruncated = names.second();
1227
            if (isTruncated) {
1228
            if (isTruncated) {
1228
                request.completionResult.setTruncated(true);
1229
                request.completionResult.setTruncated(true);
1229
                includeNonFqn = false;
1230
                includeNonFqn = false;
Lines 1446-1453 Link Here
1446
//                    return true;
1447
//                    return true;
1447
//                } else {
1448
//                } else {
1448
                Pair<Set<IndexedElement>, Boolean> names = index.getAllNamesTruncated(prefix, kind, result);
1449
                Pair<Set<IndexedElement>, Boolean> names = index.getAllNamesTruncated(prefix, kind, result);
1449
                elements = names.getA();
1450
                elements = names.first();
1450
                boolean isTruncated = names.getB();
1451
                boolean isTruncated = names.second();
1451
                if (isTruncated) {
1452
                if (isTruncated) {
1452
                    request.completionResult.setTruncated(true);
1453
                    request.completionResult.setTruncated(true);
1453
                }
1454
                }
Lines 1583-1590 Link Here
1583
1584
1584
                if (token.id() == JsTokenId.NEW) {
1585
                if (token.id() == JsTokenId.NEW) {
1585
                    Pair<Set<IndexedElement>, Boolean> constructors = index.getConstructors(prefix, kind);
1586
                    Pair<Set<IndexedElement>, Boolean> constructors = index.getConstructors(prefix, kind);
1586
                    Set<IndexedElement> elements = constructors.getA();
1587
                    Set<IndexedElement> elements = constructors.first();
1587
                    if (constructors.getB()) {
1588
                    if (constructors.second()) {
1588
                        request.completionResult.setTruncated(true);
1589
                        request.completionResult.setTruncated(true);
1589
                    }
1590
                    }
1590
                    String lhs = request.call.getLhs();
1591
                    String lhs = request.call.getLhs();
(-)a/javascript.editing/src/org/netbeans/modules/javascript/editing/JsIndex.java (-3 / +4 lines)
Lines 61-66 Link Here
61
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileStateInvalidException;
62
import org.openide.filesystems.FileStateInvalidException;
63
import org.openide.util.Exceptions;
63
import org.openide.util.Exceptions;
64
import org.openide.util.Pair;
64
65
65
/**
66
/**
66
 *
67
 *
Lines 134-140 Link Here
134
    @SuppressWarnings("unchecked")
135
    @SuppressWarnings("unchecked")
135
    public Set<IndexedElement> getAllNames(final String name, QuerySupport.Kind kind, JsParseResult context) {
136
    public Set<IndexedElement> getAllNames(final String name, QuerySupport.Kind kind, JsParseResult context) {
136
        // TODO - search by the FIELD_CLASS thingy
137
        // TODO - search by the FIELD_CLASS thingy
137
        return getUnknownFunctions(name, kind, false, context, true, true).getA();
138
        return getUnknownFunctions(name, kind, false, context, true, true).first();
138
    }
139
    }
139
140
140
    @SuppressWarnings("unchecked")
141
    @SuppressWarnings("unchecked")
Lines 351-363 Link Here
351
                    elements.add(element);
352
                    elements.add(element);
352
                    
353
                    
353
                    if (elements.size() == MAX_SEARCH_ITEMS) {
354
                    if (elements.size() == MAX_SEARCH_ITEMS) {
354
                        return new Pair<Set<IndexedElement>,Boolean>(elements, true);
355
                        return Pair.<Set<IndexedElement>,Boolean>of(elements, true);
355
                    }
356
                    }
356
                }
357
                }
357
            }
358
            }
358
        }
359
        }
359
        
360
        
360
        return new Pair<Set<IndexedElement>,Boolean>(elements, false);
361
        return Pair.<Set<IndexedElement>,Boolean>of(elements, false);
361
    }
362
    }
362
    
363
    
363
    private Set<IndexedElement> getByFqn(
364
    private Set<IndexedElement> getByFqn(
(-)a/javascript.editing/src/org/netbeans/modules/javascript/editing/Pair.java (-71 lines)
Lines 1-71 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
package org.netbeans.modules.javascript.editing;
45
46
/**
47
 *
48
 * @author Jan Lahoda
49
 */
50
public final class Pair<A, B> {
51
52
    private final A a;
53
    private final B b;
54
55
    public Pair(A a, B b) {
56
        this.a = a;
57
        this.b = b;
58
    }
59
60
    public A getA() {
61
        return a;
62
    }
63
64
    public B getB() {
65
        return b;
66
    }
67
68
    public static <A,B> Pair<A,B> of(A a, B b) {
69
      return new Pair<A, B>(a, b);
70
    } 
71
}
(-)a/jumpto/nbproject/project.xml (-1 / +1 lines)
Lines 189-195 Link Here
189
                    <build-prerequisite/>
189
                    <build-prerequisite/>
190
                    <compile-dependency/>
190
                    <compile-dependency/>
191
                    <run-dependency>
191
                    <run-dependency>
192
                        <specification-version>8.0</specification-version>
192
                        <specification-version>8.32</specification-version>
193
                    </run-dependency>
193
                    </run-dependency>
194
                </dependency>
194
                </dependency>
195
                <dependency>
195
                <dependency>
(-)a/jumpto/src/org/netbeans/modules/jumpto/common/Models.java (+1 lines)
Lines 48-53 Link Here
48
import javax.swing.AbstractListModel;
48
import javax.swing.AbstractListModel;
49
import javax.swing.ListModel;
49
import javax.swing.ListModel;
50
import org.netbeans.api.annotations.common.NonNull;
50
import org.netbeans.api.annotations.common.NonNull;
51
import org.openide.util.Pair;
51
52
52
/**
53
/**
53
 * (copied from org.netbeans.modules.java.source.util.Models
54
 * (copied from org.netbeans.modules.java.source.util.Models
(-)a/jumpto/src/org/netbeans/modules/jumpto/common/Pair.java (-101 lines)
Lines 1-101 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.jumpto.common;
43
44
import org.netbeans.api.annotations.common.NonNull;
45
import org.netbeans.api.annotations.common.NullAllowed;
46
47
/**
48
 *
49
 * @author Tomas Zezula
50
 */
51
public final class Pair<F,S> {
52
53
    public final F first;
54
    public final S second;
55
56
57
    private Pair(
58
        @NullAllowed final F first,
59
        @NullAllowed final S second) {
60
        this.first = first;
61
        this.second = second;
62
    }
63
64
    @Override
65
    public String toString() {
66
        return String.format(
67
            "Pair[%s,%s]",  //NOI18N
68
            first,
69
            second);
70
    }
71
72
    @Override
73
    public int hashCode() {
74
        int res = 17;
75
        res = res * 31 + (first == null ? 0 : first.hashCode());
76
        res = res * 31 + (second == null ? 0 : second.hashCode());
77
        return res;
78
    }
79
80
    @Override
81
    public boolean equals(@NullAllowed final Object other) {
82
        if (other == this) {
83
            return true;
84
        }
85
        if (!(other instanceof Pair)) {
86
            return false;
87
        }
88
        final Pair<?,?> otherPair = (Pair<?,?>) other;
89
        return first == null ? otherPair.first == null : first.equals(otherPair.first) &&
90
            second == null ? otherPair.second == null : second.equals(otherPair.second);
91
    }
92
93
94
    @NonNull
95
    public static <F,S> Pair<F,S> of(
96
        @NullAllowed final F first,
97
        @NullAllowed final S second) {
98
        return new Pair<F,S>(first,second);
99
    }
100
101
}
(-)a/jumpto/src/org/netbeans/modules/jumpto/file/FileSearchAction.java (-2 / +2 lines)
Lines 110-116 Link Here
110
import org.netbeans.modules.jumpto.common.Factory;
110
import org.netbeans.modules.jumpto.common.Factory;
111
import org.netbeans.modules.jumpto.type.GoToTypeAction;
111
import org.netbeans.modules.jumpto.type.GoToTypeAction;
112
import org.netbeans.modules.jumpto.common.Models;
112
import org.netbeans.modules.jumpto.common.Models;
113
import org.netbeans.modules.jumpto.common.Pair;
114
import org.netbeans.modules.parsing.spi.indexing.support.IndexResult;
113
import org.netbeans.modules.parsing.spi.indexing.support.IndexResult;
115
import org.netbeans.modules.parsing.spi.indexing.support.QuerySupport;
114
import org.netbeans.modules.parsing.spi.indexing.support.QuerySupport;
116
import org.netbeans.spi.jumpto.file.FileDescriptor;
115
import org.netbeans.spi.jumpto.file.FileDescriptor;
Lines 133-138 Link Here
133
import org.openide.util.ImageUtilities;
132
import org.openide.util.ImageUtilities;
134
import org.openide.util.Lookup;
133
import org.openide.util.Lookup;
135
import org.openide.util.NbBundle;
134
import org.openide.util.NbBundle;
135
import org.openide.util.Pair;
136
import org.openide.util.Parameters;
136
import org.openide.util.Parameters;
137
import org.openide.util.RequestProcessor;
137
import org.openide.util.RequestProcessor;
138
import org.openide.util.Utilities;
138
import org.openide.util.Utilities;
Lines 491-497 Link Here
491
                    new Factory<FileDescriptor, Pair<FileDescriptor,Runnable>>() {
491
                    new Factory<FileDescriptor, Pair<FileDescriptor,Runnable>>() {
492
                        @Override
492
                        @Override
493
                        public FileDescriptor create(@NonNull final Pair<FileDescriptor,Runnable> param) {
493
                        public FileDescriptor create(@NonNull final Pair<FileDescriptor,Runnable> param) {
494
                            return new AsyncFileDescriptor(param.first, param.second);
494
                            return new AsyncFileDescriptor(param.first(), param.second());
495
                        }
495
                        }
496
                    });
496
                    });
497
497
(-)a/maven.hints/nbproject/project.xml (-1 / +1 lines)
Lines 287-293 Link Here
287
                    <build-prerequisite/>
287
                    <build-prerequisite/>
288
                    <compile-dependency/>
288
                    <compile-dependency/>
289
                    <run-dependency>
289
                    <run-dependency>
290
                        <specification-version>8.0</specification-version>
290
                        <specification-version>8.32</specification-version>
291
                    </run-dependency>
291
                    </run-dependency>
292
                </dependency>
292
                </dependency>
293
                <dependency>
293
                <dependency>
(-)a/maven.hints/src/org/netbeans/modules/maven/hints/pom/Pair.java (-73 lines)
Lines 1-73 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
45
package org.netbeans.modules.maven.hints.pom;
46
47
/**
48
 *
49
 * @author Jan Lahoda
50
 */
51
public final class Pair<A, B> {
52
53
    private A a;
54
    private B b;
55
56
    public Pair(A a, B b) {
57
        this.a = a;
58
        this.b = b;
59
    }
60
61
    public A getA() {
62
        return a;
63
    }
64
65
    public B getB() {
66
        return b;
67
    }
68
    
69
     @Override
70
     public String toString() {
71
         return "[" + String.valueOf(a) + "/" + String.valueOf(b) + "]";
72
     }
73
}
(-)a/maven.hints/src/org/netbeans/modules/maven/hints/pom/RulesManager.java (-3 / +4 lines)
Lines 61-66 Link Here
61
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
63
import org.openide.loaders.DataObject;
63
import org.openide.loaders.DataObject;
64
import org.openide.util.Pair;
64
65
65
/** Manages rules read from the system filesystem.
66
/** Manages rules read from the system filesystem.
66
 *
67
 *
Lines 126-132 Link Here
126
                    r = instantiateRule(o);
127
                    r = instantiateRule(o);
127
                }
128
                }
128
                if ( r != null ) {
129
                if ( r != null ) {
129
                    rules.add( new Pair<POMErrorFixBase,FileObject>( r, o ) );
130
                    rules.add( Pair.<POMErrorFixBase,FileObject>of( r, o ) );
130
                }
131
                }
131
            }
132
            }
132
        }
133
        }
Lines 140-147 Link Here
140
        dir2node.put(rootFolder, rootNode);
141
        dir2node.put(rootFolder, rootNode);
141
142
142
        for( Pair<POMErrorFixBase,FileObject> pair : rules ) {
143
        for( Pair<POMErrorFixBase,FileObject> pair : rules ) {
143
            POMErrorFixBase rule = pair.getA();
144
            POMErrorFixBase rule = pair.first();
144
            FileObject fo = pair.getB();
145
            FileObject fo = pair.second();
145
146
146
                Object nonGuiObject = fo.getAttribute(NON_GUI);
147
                Object nonGuiObject = fo.getAttribute(NON_GUI);
147
                boolean toGui = true;
148
                boolean toGui = true;
(-)a/maven.j2ee/manifest.mf (-1 / +1 lines)
Lines 3-6 Link Here
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/maven/j2ee/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/maven/j2ee/Bundle.properties
4
OpenIDE-Module-Layer: org/netbeans/modules/maven/j2ee/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/maven/j2ee/layer.xml
5
AutoUpdate-Show-In-Client: false
5
AutoUpdate-Show-In-Client: false
6
OpenIDE-Module-Specification-Version: 1.34
6
OpenIDE-Module-Specification-Version: 1.35
(-)a/maven.j2ee/nbproject/project.xml (-1 / +1 lines)
Lines 324-330 Link Here
324
                    <build-prerequisite/>
324
                    <build-prerequisite/>
325
                    <compile-dependency/>
325
                    <compile-dependency/>
326
                    <run-dependency>
326
                    <run-dependency>
327
                        <specification-version>1.27</specification-version>
327
                        <specification-version>1.28</specification-version>
328
                    </run-dependency>
328
                    </run-dependency>
329
                </dependency>
329
                </dependency>
330
                <dependency>
330
                <dependency>
(-)a/openide.util/apichanges.xml (+15 lines)
Lines 51-56 Link Here
51
    <apidef name="actions">Actions API</apidef>
51
    <apidef name="actions">Actions API</apidef>
52
</apidefs>
52
</apidefs>
53
<changes>
53
<changes>
54
    <change id="pair">
55
        <api name="util"/>
56
        <summary>Added a type safe Pair of 2 elements</summary>
57
        <version major="8" minor="32"/>
58
        <date year="2013" month="5" day="1"/>
59
        <author login="tzezula"/>
60
        <compatibility addition="yes" binary="compatible" source="compatible"/>
61
        <description>
62
            <p>
63
                Added a type safe Pair of 2 elements.
64
            </p>
65
        </description>
66
        <class package="org.openide.util" name="Pair"/>
67
        <issue number="228994"/>
68
    </change>
54
    <change id="automatic-uqe">
69
    <change id="automatic-uqe">
55
        <api name="util"/>
70
        <api name="util"/>
56
        <summary>Automatic support for UserQuestionException</summary>
71
        <summary>Automatic support for UserQuestionException</summary>
(-)a/openide.util/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.util
2
OpenIDE-Module: org.openide.util
3
OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties
4
OpenIDE-Module-Specification-Version: 8.31
4
OpenIDE-Module-Specification-Version: 8.32
5
5
(-)a/openide.util/src/org/openide/util/Pair.java (+114 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2013 Sun Microsystems, Inc.
41
 */
42
package org.openide.util;
43
44
/**
45
 * A type safe pair of two object.
46
 * @author Tomas Zezula
47
 * @since 8.32
48
 */
49
public final class Pair<First,Second> {
50
51
    private final First first;
52
    private final Second second;
53
54
55
    private Pair(final First first, final Second second) {
56
        this.first = first;
57
        this.second = second;
58
    }
59
60
    /**
61
     * Returns the first element of the {@link Pair}.
62
     * @return the first element.
63
     */
64
    public First first() {
65
        return first;
66
    }
67
68
    /**
69
     * Returns the second element of the {@link Pair}.
70
     * @return the second element.
71
     */
72
    public Second second() {
73
        return second;
74
    }
75
76
    @Override
77
    public String toString () {
78
        return String.format("Pair[%s,%s]", first,second);  //NOI18N
79
    }
80
81
    @Override
82
    public boolean equals(final Object other) {
83
        if (other == this) {
84
            return true;
85
        }
86
        if (!(other instanceof Pair)) {
87
            return false;
88
        }
89
        final Pair<?,?> otherPair = (Pair<?,?>) other;
90
        return (first == null ? otherPair.first == null : first.equals(otherPair.first)) &&
91
            (second == null ? otherPair.second == null : second.equals(otherPair.second));
92
    }
93
94
    @Override
95
    public int hashCode() {
96
        int res = 17;
97
        res = res * 31 + (first == null ? 0 : first.hashCode());
98
        res = res * 31 + (second == null ? 0 : second.hashCode());
99
        return res;
100
    }
101
102
103
    /**
104
     * Creates a new Pair.
105
     * @param <First>   the type of the first element
106
     * @param <Second>  the type of the second element
107
     * @param first     the first element
108
     * @param second    the second element
109
     * @return  the new {@link Pair} of the first and second elements.
110
     */
111
    public static <First,Second> Pair<First,Second> of (final First first, final Second second) {
112
        return new Pair<First, Second>(first, second);
113
    }
114
}
(-)a/openide.util/test/unit/src/org/openide/util/PairTest.java (+79 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2013 Sun Microsystems, Inc.
41
 */
42
package org.openide.util;
43
44
import org.netbeans.junit.NbTestCase;
45
46
/**
47
 *
48
 * @author Tomas Zezula
49
 */
50
public class PairTest extends NbTestCase {
51
52
    public PairTest(String name) {
53
        super(name);
54
    }
55
56
57
    public void testPairs() {
58
        final Pair<Integer,Integer> p1a = Pair.of(1, 1);
59
        final Pair<Integer,Integer> p1b = Pair.of(1, 1);
60
        final Pair<Integer,Integer> p2 = Pair.of(1, 2);
61
        final Pair<Integer,Integer> p3 = Pair.of(2, 1);
62
        final Pair<Integer,Integer> p4 = Pair.of(null, 1);
63
        final Pair<Integer,Integer> p5 = Pair.of(1, null);
64
        final Pair<Integer,Integer> p6 = Pair.of(null, null);
65
        assertTrue(p1a.equals(p1a));
66
        assertTrue(p1a.equals(p1b));
67
        assertFalse(p1a.equals(p2));
68
        assertFalse(p1a.equals(p3));
69
        assertFalse(p1a.equals(p4));
70
        assertFalse(p1a.equals(p5));
71
        assertFalse(p1a.equals(p6));
72
        assertEquals(p1a.hashCode(), p1b.hashCode());
73
        assertEquals(p4.hashCode(), p4.hashCode());
74
        assertEquals(p5.hashCode(), p5.hashCode());
75
        assertEquals(p6.hashCode(), p6.hashCode());
76
        assertFalse(p4.hashCode() == p5.hashCode());
77
    }
78
79
}
(-)a/parsing.api/nbproject/project.xml (-1 / +1 lines)
Lines 218-224 Link Here
218
                    <build-prerequisite/>
218
                    <build-prerequisite/>
219
                    <compile-dependency/>
219
                    <compile-dependency/>
220
                    <run-dependency>
220
                    <run-dependency>
221
                        <specification-version>8.25</specification-version>
221
                        <specification-version>8.32</specification-version>
222
                    </run-dependency>
222
                    </run-dependency>
223
                </dependency>
223
                </dependency>
224
                <dependency>
224
                <dependency>
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/SourceCache.java (-1 / +1 lines)
Lines 63-69 Link Here
63
import org.netbeans.modules.parsing.api.Snapshot;
63
import org.netbeans.modules.parsing.api.Snapshot;
64
import org.netbeans.modules.parsing.api.Source;
64
import org.netbeans.modules.parsing.api.Source;
65
import org.netbeans.modules.parsing.api.Task;
65
import org.netbeans.modules.parsing.api.Task;
66
import org.netbeans.modules.parsing.impl.indexing.Pair;
67
import org.netbeans.modules.parsing.spi.EmbeddingProvider;
66
import org.netbeans.modules.parsing.spi.EmbeddingProvider;
68
import org.netbeans.modules.parsing.spi.ParseException;
67
import org.netbeans.modules.parsing.spi.ParseException;
69
import org.netbeans.modules.parsing.spi.Parser;
68
import org.netbeans.modules.parsing.spi.Parser;
Lines 76-81 Link Here
76
import org.netbeans.modules.parsing.spi.Scheduler;
75
import org.netbeans.modules.parsing.spi.Scheduler;
77
import org.openide.filesystems.FileObject;
76
import org.openide.filesystems.FileObject;
78
import org.openide.util.Lookup;
77
import org.openide.util.Lookup;
78
import org.openide.util.Pair;
79
79
80
80
81
/**
81
/**
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/TaskProcessor.java (-3 / +3 lines)
Lines 79-91 Link Here
79
import org.netbeans.modules.parsing.api.Task;
79
import org.netbeans.modules.parsing.api.Task;
80
import org.netbeans.modules.parsing.api.UserTask;
80
import org.netbeans.modules.parsing.api.UserTask;
81
import org.netbeans.modules.parsing.api.indexing.IndexingManager;
81
import org.netbeans.modules.parsing.api.indexing.IndexingManager;
82
import org.netbeans.modules.parsing.impl.indexing.Pair;
83
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
82
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
84
import org.netbeans.modules.parsing.impl.indexing.Util;
83
import org.netbeans.modules.parsing.impl.indexing.Util;
85
import org.netbeans.modules.parsing.spi.*;
84
import org.netbeans.modules.parsing.spi.*;
86
import org.netbeans.modules.parsing.spi.Parser.Result;
85
import org.netbeans.modules.parsing.spi.Parser.Result;
87
import org.openide.util.Exceptions;
86
import org.openide.util.Exceptions;
88
import org.openide.util.Mutex;
87
import org.openide.util.Mutex;
88
import org.openide.util.Pair;
89
import org.openide.util.Parameters;
89
import org.openide.util.Parameters;
90
import org.openide.util.RequestProcessor;
90
import org.openide.util.RequestProcessor;
91
91
Lines 476-487 Link Here
476
        Parameters.notNull("cache", cache);   //NOI18N
476
        Parameters.notNull("cache", cache);   //NOI18N
477
        List<Request> _requests = new ArrayList<Request> ();
477
        List<Request> _requests = new ArrayList<Request> ();
478
        for (Pair<SchedulerTask,Class<? extends Scheduler>> task : tasks) {
478
        for (Pair<SchedulerTask,Class<? extends Scheduler>> task : tasks) {
479
            final String taskClassName = task.first.getClass().getName();
479
            final String taskClassName = task.first().getClass().getName();
480
            if (excludedTasks != null && excludedTasks.matcher(taskClassName).matches()) {
480
            if (excludedTasks != null && excludedTasks.matcher(taskClassName).matches()) {
481
                if (includedTasks == null || !includedTasks.matcher(taskClassName).matches())
481
                if (includedTasks == null || !includedTasks.matcher(taskClassName).matches())
482
                    continue;
482
                    continue;
483
            }
483
            }
484
            _requests.add (new Request (task.first, cache, bridge ? ReschedulePolicy.ON_CHANGE : ReschedulePolicy.CANCELED, task.second));
484
            _requests.add (new Request (task.first(), cache, bridge ? ReschedulePolicy.ON_CHANGE : ReschedulePolicy.CANCELED, task.second()));
485
        }
485
        }
486
        return _requests;
486
        return _requests;
487
    }
487
    }
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/Utilities.java (-1 / +1 lines)
Lines 50-61 Link Here
50
import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
50
import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
51
import org.netbeans.modules.parsing.api.Source;
51
import org.netbeans.modules.parsing.api.Source;
52
import org.netbeans.modules.parsing.impl.event.EventSupport;
52
import org.netbeans.modules.parsing.impl.event.EventSupport;
53
import org.netbeans.modules.parsing.impl.indexing.Pair;
54
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
53
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
55
import org.netbeans.modules.parsing.spi.Parser;
54
import org.netbeans.modules.parsing.spi.Parser;
56
import org.netbeans.modules.parsing.spi.ParserResultTask;
55
import org.netbeans.modules.parsing.spi.ParserResultTask;
57
import org.netbeans.modules.parsing.spi.Scheduler;
56
import org.netbeans.modules.parsing.spi.Scheduler;
58
import org.netbeans.modules.parsing.spi.SchedulerTask;
57
import org.netbeans.modules.parsing.spi.SchedulerTask;
58
import org.openide.util.Pair;
59
import org.openide.util.Parameters;
59
import org.openide.util.Parameters;
60
60
61
/**
61
/**
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ArchiveTimeStamps.java (-5 / +6 lines)
Lines 56-61 Link Here
56
import org.openide.filesystems.FileUtil;
56
import org.openide.filesystems.FileUtil;
57
import org.openide.util.EditableProperties;
57
import org.openide.util.EditableProperties;
58
import org.openide.util.Exceptions;
58
import org.openide.util.Exceptions;
59
import org.openide.util.Pair;
59
import org.openide.util.Parameters;
60
import org.openide.util.Parameters;
60
import org.openide.util.RequestProcessor;
61
import org.openide.util.RequestProcessor;
61
62
Lines 158-174 Link Here
158
    @NonNull
159
    @NonNull
159
    private static String generate(Pair<Long,Map<Pair<String,Integer>,Integer>> data) {
160
    private static String generate(Pair<Long,Map<Pair<String,Integer>,Integer>> data) {
160
        final StringBuilder sb = new StringBuilder();
161
        final StringBuilder sb = new StringBuilder();
161
        for (Map.Entry<Pair<String,Integer>,Integer> r : data.second.entrySet()) {
162
        for (Map.Entry<Pair<String,Integer>,Integer> r : data.second().entrySet()) {
162
            final Pair<String,Integer> key = r.getKey();
163
            final Pair<String,Integer> key = r.getKey();
163
            assert key.first.indexOf(SEPARATOR) < 0;
164
            assert key.first().indexOf(SEPARATOR) < 0;
164
            sb.append(key.first);
165
            sb.append(key.first());
165
            sb.append(SEPARATOR);
166
            sb.append(SEPARATOR);
166
            sb.append(key.second);
167
            sb.append(key.second());
167
            sb.append(SEPARATOR);
168
            sb.append(SEPARATOR);
168
            sb.append(r.getValue());
169
            sb.append(r.getValue());
169
            sb.append(SEPARATOR);
170
            sb.append(SEPARATOR);
170
        }
171
        }
171
        sb.append(data.first);
172
        sb.append(data.first());
172
        return sb.toString();
173
        return sb.toString();
173
    }
174
    }
174
175
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java (-4 / +5 lines)
Lines 72-77 Link Here
72
import org.netbeans.modules.parsing.lucene.support.DocumentIndexCache;
72
import org.netbeans.modules.parsing.lucene.support.DocumentIndexCache;
73
import org.netbeans.modules.parsing.lucene.support.IndexDocument;
73
import org.netbeans.modules.parsing.lucene.support.IndexDocument;
74
import org.netbeans.modules.parsing.spi.indexing.Indexable;
74
import org.netbeans.modules.parsing.spi.indexing.Indexable;
75
import org.openide.util.Pair;
75
import org.openide.util.Parameters;
76
import org.openide.util.Parameters;
76
import org.openide.util.Utilities;
77
import org.openide.util.Utilities;
77
78
Lines 725-734 Link Here
725
                    MessageFormat.format(
726
                    MessageFormat.format(
726
                        "{0} : Attached at: {1} by: {2}, Detached at: {3} by: {4}",   //NOI18N
727
                        "{0} : Attached at: {1} by: {2}, Detached at: {3} by: {4}",   //NOI18N
727
                        reason,
728
                        reason,
728
                        attach == null ? null : attach.first,
729
                        attach == null ? null : attach.first(),
729
                        attach == null ? null : Arrays.asList(attach.second),
730
                        attach == null ? null : Arrays.asList(attach.second()),
730
                        detach == null ? null : detach.first,
731
                        detach == null ? null : detach.first(),
731
                        detach == null ? null : Arrays.asList(detach.second)));
732
                        detach == null ? null : Arrays.asList(detach.second())));
732
            }
733
            }
733
            
734
            
734
        }
735
        }
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/FileEventLog.java (-5 / +6 lines)
Lines 52-57 Link Here
52
import java.util.logging.Logger;
52
import java.util.logging.Logger;
53
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.Work;
53
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.Work;
54
import org.openide.filesystems.FileEvent;
54
import org.openide.filesystems.FileEvent;
55
import org.openide.util.Pair;
55
56
56
/**
57
/**
57
 *
58
 *
Lines 123-136 Link Here
123
        if (myChanges != null) {
124
        if (myChanges != null) {
124
            for (Map<String,Pair<FileOp,Work>> changesInRoot : myChanges.values()) {
125
            for (Map<String,Pair<FileOp,Work>> changesInRoot : myChanges.values()) {
125
                for (Pair<FileOp,Work> desc : changesInRoot.values()) {
126
                for (Pair<FileOp,Work> desc : changesInRoot.values()) {
126
                    if (desc.first == FileOp.DELETE) {
127
                    if (desc.first() == FileOp.DELETE) {
127
                        if (!seenDelete.containsKey(desc.second)) {
128
                        if (!seenDelete.containsKey(desc.second())) {
128
                            first.add(desc.second);
129
                            first.add(desc.second());
129
                            seenDelete.put(desc.second, desc.second);
130
                            seenDelete.put(desc.second(), desc.second());
130
                        }
131
                        }
131
                    }
132
                    }
132
                    else {
133
                    else {
133
                        rest.add(desc.second);
134
                        rest.add(desc.second());
134
                    }
135
                    }
135
                }
136
                }
136
            }
137
            }
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/FileObjectCrawler.java (+1 lines)
Lines 65-70 Link Here
65
import org.netbeans.modules.parsing.spi.indexing.Indexable;
65
import org.netbeans.modules.parsing.spi.indexing.Indexable;
66
import org.openide.filesystems.FileObject;
66
import org.openide.filesystems.FileObject;
67
import org.openide.filesystems.FileUtil;
67
import org.openide.filesystems.FileUtil;
68
import org.openide.util.Pair;
68
69
69
/**
70
/**
70
 *
71
 *
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/IndexBinaryWorkPool.java (+1 lines)
Lines 52-57 Link Here
52
import java.util.logging.Logger;
52
import java.util.logging.Logger;
53
import org.netbeans.api.annotations.common.NonNull;
53
import org.netbeans.api.annotations.common.NonNull;
54
import org.openide.util.Exceptions;
54
import org.openide.util.Exceptions;
55
import org.openide.util.Pair;
55
import org.openide.util.RequestProcessor;
56
import org.openide.util.RequestProcessor;
56
57
57
/**
58
/**
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/LogContext.java (-2 / +3 lines)
Lines 49-54 Link Here
49
import org.netbeans.api.java.classpath.ClassPath;
49
import org.netbeans.api.java.classpath.ClassPath;
50
import org.openide.filesystems.FileObject;
50
import org.openide.filesystems.FileObject;
51
import org.openide.util.NbBundle;
51
import org.openide.util.NbBundle;
52
import org.openide.util.Pair;
52
import org.openide.util.Parameters;
53
import org.openide.util.Parameters;
53
import org.openide.util.RequestProcessor;
54
import org.openide.util.RequestProcessor;
54
import org.openide.util.Utilities;
55
import org.openide.util.Utilities;
Lines 1038-1048 Link Here
1038
                return;
1039
                return;
1039
            }
1040
            }
1040
            
1041
            
1041
            LOG.log(Level.WARNING, "Excessive indexing rate detected: " + dataSize(found.first, found.second) + " in " + minutes + "mins, treshold is " + treshold + 
1042
            LOG.log(Level.WARNING, "Excessive indexing rate detected: " + dataSize(found.first(), found.second()) + " in " + minutes + "mins, treshold is " + treshold +
1042
                    ". Dumping suspicious contexts");
1043
                    ". Dumping suspicious contexts");
1043
            int index;
1044
            int index;
1044
            
1045
            
1045
             for (index = found.first; index != found.second; index = (index + 1) % times.length) {
1046
             for (index = found.first(); index != found.second(); index = (index + 1) % times.length) {
1046
                contexts[index].log(false, false);
1047
                contexts[index].log(false, false);
1047
            }
1048
            }
1048
            LOG.log(Level.WARNING, "=== End excessive indexing");
1049
            LOG.log(Level.WARNING, "=== End excessive indexing");
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/Pair.java (-87 lines)
Lines 1-87 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.parsing.impl.indexing;
44
45
/**
46
 *
47
 * @author Tomas Zezula
48
 */
49
public final class Pair<P,K> {
50
51
    public final P first;
52
    public final K second;
53
54
    private Pair (P first, K second) {
55
        this.first = first;
56
        this.second = second;
57
    }
58
59
60
    public static <P,K> Pair<P,K> of (P first, K second) {
61
        return new Pair<P,K> (first,second);
62
    }
63
64
65
    @Override
66
    public int hashCode () {
67
        int hashCode  = 0;
68
        hashCode ^= first == null ? 0 : first.hashCode();
69
        hashCode ^= second == null ? 0: second.hashCode();
70
        return hashCode;
71
    }
72
73
    @Override
74
    public boolean equals (final Object other) {
75
        if (other instanceof Pair) {
76
            Pair otherPair = (Pair) other;
77
            return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) &&
78
                   (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second));
79
        }
80
        return false;
81
    }
82
83
    @Override
84
    public String toString () {
85
        return String.format("Pair[%s,%s]", first,second);
86
    }
87
}
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java (-127 / +128 lines)
Lines 126-131 Link Here
126
import org.openide.util.Lookup;
126
import org.openide.util.Lookup;
127
import org.openide.util.Mutex.ExceptionAction;
127
import org.openide.util.Mutex.ExceptionAction;
128
import org.openide.util.NbBundle;
128
import org.openide.util.NbBundle;
129
import org.openide.util.Pair;
129
import org.openide.util.Parameters;
130
import org.openide.util.Parameters;
130
import org.openide.util.RequestProcessor;
131
import org.openide.util.RequestProcessor;
131
import org.openide.util.TopologicalSortException;
132
import org.openide.util.TopologicalSortException;
Lines 626-645 Link Here
626
        if (fo != null && fo.isValid()) {
627
        if (fo != null && fo.isValid()) {
627
            if (source == null || source.booleanValue()) {
628
            if (source == null || source.booleanValue()) {
628
                root = getOwningSourceRoot(fo);
629
                root = getOwningSourceRoot(fo);
629
                if (root != null && visibilitySupport.isVisible(fo, root.second)) {
630
                if (root != null && visibilitySupport.isVisible(fo, root.second())) {
630
                    if (root.second == null) {
631
                    if (root.second() == null) {
631
                        LOGGER.log(
632
                        LOGGER.log(
632
                            Level.INFO,
633
                            Level.INFO,
633
                            "Ignoring event from non existing FileObject {0}",  //NOI18N
634
                            "Ignoring event from non existing FileObject {0}",  //NOI18N
634
                            root.first);
635
                            root.first());
635
                        return;
636
                        return;
636
                    }
637
                    }
637
                    boolean sourcForBinaryRoot = sourcesForBinaryRoots.contains(root.first);
638
                    boolean sourcForBinaryRoot = sourcesForBinaryRoots.contains(root.first());
638
                    ClassPath.Entry entry = sourcForBinaryRoot ? null : getClassPathEntry(root.second);
639
                    ClassPath.Entry entry = sourcForBinaryRoot ? null : getClassPathEntry(root.second());
639
                    if (entry == null || entry.includes(fo)) {
640
                    if (entry == null || entry.includes(fo)) {
640
                        Work wrk;
641
                        Work wrk;
641
                        if (fo.equals(root.second)) {
642
                        if (fo.equals(root.second())) {
642
                            if (scannedRoots2Dependencies.get(root.first) == EMPTY_DEPS) {
643
                            if (scannedRoots2Dependencies.get(root.first()) == EMPTY_DEPS) {
643
                                //For first time seeing valid root do roots work to recalculate dependencies
644
                                //For first time seeing valid root do roots work to recalculate dependencies
644
                                wrk = new RootsWork(
645
                                wrk = new RootsWork(
645
                                    scannedRoots2Dependencies,
646
                                    scannedRoots2Dependencies,
Lines 649-655 Link Here
649
                                    false,
650
                                    false,
650
                                    scannedRoots2DependenciesLamport,
651
                                    scannedRoots2DependenciesLamport,
651
                                    suspendSupport.getSuspendStatus(),
652
                                    suspendSupport.getSuspendStatus(),
652
                                    LogContext.create(LogContext.EventType.FILE, null).addRoots(Collections.singleton(root.first)));
653
                                    LogContext.create(LogContext.EventType.FILE, null).addRoots(Collections.singleton(root.first())));
653
                            } else {
654
                            } else {
654
                                //Already seen files work is enough
655
                                //Already seen files work is enough
655
                                final FileObject[] children = fo.getChildren();
656
                                final FileObject[] children = fo.getChildren();
Lines 657-663 Link Here
657
                                if (children.length > 0) {
658
                                if (children.length > 0) {
658
                                    wrk = new FileListWork(
659
                                    wrk = new FileListWork(
659
                                        scannedRoots2Dependencies,
660
                                        scannedRoots2Dependencies,
660
                                        root.first,
661
                                        root.first(),
661
                                        c,
662
                                        c,
662
                                        false,
663
                                        false,
663
                                        false,
664
                                        false,
Lines 666-672 Link Here
666
                                        true,
667
                                        true,
667
                                        suspendSupport.getSuspendStatus(),
668
                                        suspendSupport.getSuspendStatus(),
668
                                        LogContext.create(LogContext.EventType.FILE, null).
669
                                        LogContext.create(LogContext.EventType.FILE, null).
669
                                            withRoot(root.first).
670
                                            withRoot(root.first()).
670
                                            addFileObjects(c));
671
                                            addFileObjects(c));
671
                                } else {
672
                                } else {
672
                                    //If no children nothing needs to be done - save some CPU time
673
                                    //If no children nothing needs to be done - save some CPU time
Lines 677-683 Link Here
677
                            Collection<FileObject> c = Collections.singleton(fo);
678
                            Collection<FileObject> c = Collections.singleton(fo);
678
                            wrk = new FileListWork(
679
                            wrk = new FileListWork(
679
                                scannedRoots2Dependencies,
680
                                scannedRoots2Dependencies,
680
                                root.first,
681
                                root.first(),
681
                                c,
682
                                c,
682
                                false,
683
                                false,
683
                                false,
684
                                false,
Lines 686-696 Link Here
686
                                true,
687
                                true,
687
                                suspendSupport.getSuspendStatus(),
688
                                suspendSupport.getSuspendStatus(),
688
                                LogContext.create(LogContext.EventType.FILE, null).
689
                                LogContext.create(LogContext.EventType.FILE, null).
689
                                    withRoot(root.first).
690
                                    withRoot(root.first()).
690
                                    addFileObjects(c));
691
                                    addFileObjects(c));
691
                        }
692
                        }
692
                        if (wrk != null) {
693
                        if (wrk != null) {
693
                            eventQueue.record(FileEventLog.FileOp.CREATE, root.first, FileUtil.getRelativePath(root.second, fo), fe, wrk);
694
                            eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), FileUtil.getRelativePath(root.second(), fo), fe, wrk);
694
                        }
695
                        }
695
                        processed = true;
696
                        processed = true;
696
                    }
697
                    }
Lines 699-712 Link Here
699
700
700
            if (!processed && (source == null || !source.booleanValue())) {
701
            if (!processed && (source == null || !source.booleanValue())) {
701
                root = getOwningBinaryRoot(fo);
702
                root = getOwningBinaryRoot(fo);
702
                if (root != null && visibilitySupport.isVisible(fo, root.second)) {
703
                if (root != null && visibilitySupport.isVisible(fo, root.second())) {
703
                    final Work wrk = new BinaryWork(
704
                    final Work wrk = new BinaryWork(
704
                        root.first,
705
                        root.first(),
705
                        suspendSupport.getSuspendStatus(),
706
                        suspendSupport.getSuspendStatus(),
706
                        LogContext.create(LogContext.EventType.FILE, null).
707
                        LogContext.create(LogContext.EventType.FILE, null).
707
                            withRoot(root.first).
708
                            withRoot(root.first()).
708
                            addFileObjects(Collections.singleton(fo)));
709
                            addFileObjects(Collections.singleton(fo)));
709
                    eventQueue.record(FileEventLog.FileOp.CREATE, root.first, null, fe, wrk);
710
                    eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), null, fe, wrk);
710
                    processed = true;
711
                    processed = true;
711
                }
712
                }
712
            }
713
            }
Lines 734-753 Link Here
734
        if (fo != null && fo.isValid()) {
735
        if (fo != null && fo.isValid()) {
735
            if (source == null || source.booleanValue()) {
736
            if (source == null || source.booleanValue()) {
736
                root = getOwningSourceRoot (fo);
737
                root = getOwningSourceRoot (fo);
737
                if (root != null && visibilitySupport.isVisible(fo,root.second)) {
738
                if (root != null && visibilitySupport.isVisible(fo,root.second())) {
738
                    if (root.second == null) {
739
                    if (root.second() == null) {
739
                        LOGGER.log(
740
                        LOGGER.log(
740
                            Level.INFO,
741
                            Level.INFO,
741
                            "Ignoring event from non existing FileObject {0}",  //NOI18N
742
                            "Ignoring event from non existing FileObject {0}",  //NOI18N
742
                            root.first);
743
                            root.first());
743
                        return;
744
                        return;
744
                    }
745
                    }
745
                    boolean sourceForBinaryRoot = sourcesForBinaryRoots.contains(root.first);
746
                    boolean sourceForBinaryRoot = sourcesForBinaryRoots.contains(root.first());
746
                    ClassPath.Entry entry = sourceForBinaryRoot ? null : getClassPathEntry(root.second);
747
                    ClassPath.Entry entry = sourceForBinaryRoot ? null : getClassPathEntry(root.second());
747
                    if (entry == null || entry.includes(fo)) {
748
                    if (entry == null || entry.includes(fo)) {
748
                        final Work wrk = new FileListWork(
749
                        final Work wrk = new FileListWork(
749
                            scannedRoots2Dependencies,
750
                            scannedRoots2Dependencies,
750
                            root.first,
751
                            root.first(),
751
                            Collections.singleton(fo),
752
                            Collections.singleton(fo),
752
                            false,
753
                            false,
753
                            false,
754
                            false,
Lines 756-764 Link Here
756
                            true,
757
                            true,
757
                            suspendSupport.getSuspendStatus(),
758
                            suspendSupport.getSuspendStatus(),
758
                            LogContext.create(LogContext.EventType.FILE, null).
759
                            LogContext.create(LogContext.EventType.FILE, null).
759
                                withRoot(root.first).
760
                                withRoot(root.first()).
760
                                addFiles(Collections.singleton(fo.toURL())));
761
                                addFiles(Collections.singleton(fo.toURL())));
761
                        eventQueue.record(FileEventLog.FileOp.CREATE, root.first, FileUtil.getRelativePath(root.second, fo), fe, wrk);
762
                        eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), FileUtil.getRelativePath(root.second(), fo), fe, wrk);
762
                        processed = true;
763
                        processed = true;
763
                    }
764
                    }
764
                }
765
                }
Lines 766-779 Link Here
766
767
767
            if (!processed && (source == null || !source.booleanValue())) {
768
            if (!processed && (source == null || !source.booleanValue())) {
768
                root = getOwningBinaryRoot(fo);
769
                root = getOwningBinaryRoot(fo);
769
                if (root != null && visibilitySupport.isVisible(fo,root.second)) {
770
                if (root != null && visibilitySupport.isVisible(fo,root.second())) {
770
                    final Work wrk = new BinaryWork(
771
                    final Work wrk = new BinaryWork(
771
                        root.first,
772
                        root.first(),
772
                        suspendSupport.getSuspendStatus(),
773
                        suspendSupport.getSuspendStatus(),
773
                        LogContext.create(LogContext.EventType.FILE, null).
774
                        LogContext.create(LogContext.EventType.FILE, null).
774
                            withRoot(root.first).
775
                            withRoot(root.first()).
775
                            addFiles(Collections.singleton(fo.toURL())));
776
                            addFiles(Collections.singleton(fo.toURL())));
776
                    eventQueue.record(FileEventLog.FileOp.CREATE, root.first, null, fe, wrk);
777
                    eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), null, fe, wrk);
777
                    processed = true;
778
                    processed = true;
778
                }
779
                }
779
            }
780
            }
Lines 807-830 Link Here
807
        if (fo != null) {
808
        if (fo != null) {
808
            if (source == null || source.booleanValue()) {
809
            if (source == null || source.booleanValue()) {
809
                root = getOwningSourceRoot (fo);
810
                root = getOwningSourceRoot (fo);
810
                if (root != null && fo.isData() && visibilitySupport.isVisible(fo, root.second)) {
811
                if (root != null && fo.isData() && visibilitySupport.isVisible(fo, root.second())) {
811
                    String relativePath = null;
812
                    String relativePath = null;
812
                    try {
813
                    try {
813
                    //Root may be deleted -> no root.second available
814
                    //Root may be deleted -> no root.second available
814
                        if (root.second != null) {
815
                        if (root.second() != null) {
815
                            relativePath = FileUtil.getRelativePath(root.second, fo);
816
                            relativePath = FileUtil.getRelativePath(root.second(), fo);
816
                        } else {
817
                        } else {
817
                            relativePath = root.first.toURI().relativize(fo.getURL().toURI()).getPath();
818
                            relativePath = root.first().toURI().relativize(fo.getURL().toURI()).getPath();
818
                        }
819
                        }
819
                        assert relativePath != null : "FileObject not under root: f=" + fo + ", root=" + root; //NOI18N
820
                        assert relativePath != null : "FileObject not under root: f=" + fo + ", root=" + root; //NOI18N
820
                        final Work wrk = new DeleteWork(
821
                        final Work wrk = new DeleteWork(
821
                            root.first,
822
                            root.first(),
822
                            Collections.singleton(relativePath),
823
                            Collections.singleton(relativePath),
823
                            suspendSupport.getSuspendStatus(),
824
                            suspendSupport.getSuspendStatus(),
824
                            LogContext.create(LogContext.EventType.FILE, null).
825
                            LogContext.create(LogContext.EventType.FILE, null).
825
                                withRoot(root.first).
826
                                withRoot(root.first()).
826
                                addFiles(Collections.singleton(fo.toURL())));
827
                                addFiles(Collections.singleton(fo.toURL())));
827
                        eventQueue.record(FileEventLog.FileOp.DELETE, root.first, relativePath, fe, wrk);
828
                        eventQueue.record(FileEventLog.FileOp.DELETE, root.first(), relativePath, fe, wrk);
828
                        processed = true;
829
                        processed = true;
829
                    } catch (FileStateInvalidException fse) {
830
                    } catch (FileStateInvalidException fse) {
830
                        Exceptions.printStackTrace(fse);
831
                        Exceptions.printStackTrace(fse);
Lines 836-849 Link Here
836
837
837
            if (!processed && (source == null || !source.booleanValue())) {
838
            if (!processed && (source == null || !source.booleanValue())) {
838
                root = getOwningBinaryRoot(fo);
839
                root = getOwningBinaryRoot(fo);
839
                if (root != null && visibilitySupport.isVisible(fo, root.second)) {
840
                if (root != null && visibilitySupport.isVisible(fo, root.second())) {
840
                    final Work wrk = new BinaryWork(
841
                    final Work wrk = new BinaryWork(
841
                        root.first,
842
                        root.first(),
842
                        suspendSupport.getSuspendStatus(),
843
                        suspendSupport.getSuspendStatus(),
843
                        LogContext.create(LogContext.EventType.FILE, null).
844
                        LogContext.create(LogContext.EventType.FILE, null).
844
                            withRoot(root.first).
845
                            withRoot(root.first()).
845
                            addFiles(Collections.singleton(fo.toURL())));
846
                            addFiles(Collections.singleton(fo.toURL())));
846
                    eventQueue.record(FileEventLog.FileOp.DELETE, root.first, null, fe, wrk);
847
                    eventQueue.record(FileEventLog.FileOp.DELETE, root.first(), null, fe, wrk);
847
                    processed = true;
848
                    processed = true;
848
                }
849
                }
849
            }
850
            }
Lines 879-892 Link Here
879
            if (source == null || source.booleanValue()) {
880
            if (source == null || source.booleanValue()) {
880
                root = getOwningSourceRoot(newFile);
881
                root = getOwningSourceRoot(newFile);
881
                if (root != null) {
882
                if (root != null) {
882
                    if (root.second == null) {
883
                    if (root.second() == null) {
883
                        LOGGER.log(
884
                        LOGGER.log(
884
                            Level.INFO,
885
                            Level.INFO,
885
                            "Ignoring event from non existing FileObject {0}",  //NOI18N
886
                            "Ignoring event from non existing FileObject {0}",  //NOI18N
886
                            root.first);
887
                            root.first());
887
                        return;
888
                        return;
888
                    }
889
                    }
889
                    FileObject rootFo = root.second;
890
                    FileObject rootFo = root.second();
890
                    if (rootFo.equals(newFile)) {
891
                    if (rootFo.equals(newFile)) {
891
                        //Root renamed do nothing, will be fired as ClassPath change.
892
                        //Root renamed do nothing, will be fired as ClassPath change.
892
                        return;
893
                        return;
Lines 895-929 Link Here
895
                    String oldFilePath =  ownerPath.length() == 0 ? oldNameExt : ownerPath + "/" + oldNameExt; //NOI18N
896
                    String oldFilePath =  ownerPath.length() == 0 ? oldNameExt : ownerPath + "/" + oldNameExt; //NOI18N
896
                    if (newFile.isData()) {
897
                    if (newFile.isData()) {
897
                        final Work work = new DeleteWork(
898
                        final Work work = new DeleteWork(
898
                            root.first,
899
                            root.first(),
899
                            Collections.singleton(oldFilePath),
900
                            Collections.singleton(oldFilePath),
900
                            suspendSupport.getSuspendStatus(),
901
                            suspendSupport.getSuspendStatus(),
901
                            LogContext.create(LogContext.EventType.FILE, null).
902
                            LogContext.create(LogContext.EventType.FILE, null).
902
                                withRoot(root.first).
903
                                withRoot(root.first()).
903
                                addFilePaths(Collections.singleton(oldFilePath)));
904
                                addFilePaths(Collections.singleton(oldFilePath)));
904
                        eventQueue.record(FileEventLog.FileOp.DELETE, root.first, oldFilePath, fe, work);
905
                        eventQueue.record(FileEventLog.FileOp.DELETE, root.first(), oldFilePath, fe, work);
905
                    } else {
906
                    } else {
906
                        Set<String> oldFilePaths = new HashSet<String>();
907
                        Set<String> oldFilePaths = new HashSet<String>();
907
                        collectFilePaths(newFile, oldFilePath, oldFilePaths);
908
                        collectFilePaths(newFile, oldFilePath, oldFilePaths);
908
                        for (String path : oldFilePaths) {
909
                        for (String path : oldFilePaths) {
909
                            final Work work = new DeleteWork(
910
                            final Work work = new DeleteWork(
910
                                root.first,
911
                                root.first(),
911
                                oldFilePaths,
912
                                oldFilePaths,
912
                                suspendSupport.getSuspendStatus(),
913
                                suspendSupport.getSuspendStatus(),
913
                                LogContext.create(LogContext.EventType.FILE, null).
914
                                LogContext.create(LogContext.EventType.FILE, null).
914
                                    withRoot(root.first).
915
                                    withRoot(root.first()).
915
                                    addFilePaths(oldFilePaths));
916
                                    addFilePaths(oldFilePaths));
916
                            eventQueue.record(FileEventLog.FileOp.DELETE, root.first, path, fe, work);
917
                            eventQueue.record(FileEventLog.FileOp.DELETE, root.first(), path, fe, work);
917
                        }
918
                        }
918
                    }
919
                    }
919
920
920
                    if (visibilitySupport.isVisible(newFile,root.second)) {
921
                    if (visibilitySupport.isVisible(newFile,root.second())) {
921
                        final boolean sourceForBinaryRoot = sourcesForBinaryRoots.contains(root.first);
922
                        final boolean sourceForBinaryRoot = sourcesForBinaryRoots.contains(root.first());
922
                        ClassPath.Entry entry = sourceForBinaryRoot ? null : getClassPathEntry(rootFo);
923
                        ClassPath.Entry entry = sourceForBinaryRoot ? null : getClassPathEntry(rootFo);
923
                        if (entry == null || entry.includes(newFile)) {
924
                        if (entry == null || entry.includes(newFile)) {
924
                            final FileListWork flw = new FileListWork(
925
                            final FileListWork flw = new FileListWork(
925
                                scannedRoots2Dependencies,
926
                                scannedRoots2Dependencies,
926
                                root.first,
927
                                root.first(),
927
                                Collections.singleton(newFile),
928
                                Collections.singleton(newFile),
928
                                false,
929
                                false,
929
                                false,
930
                                false,
Lines 932-940 Link Here
932
                                true,
933
                                true,
933
                                suspendSupport.getSuspendStatus(),
934
                                suspendSupport.getSuspendStatus(),
934
                                LogContext.create(LogContext.EventType.FILE, null).
935
                                LogContext.create(LogContext.EventType.FILE, null).
935
                                    withRoot(root.first).
936
                                    withRoot(root.first()).
936
                                    addFileObjects(Collections.singleton(newFile)));
937
                                    addFileObjects(Collections.singleton(newFile)));
937
                            eventQueue.record(FileEventLog.FileOp.CREATE, root.first, FileUtil.getRelativePath(rootFo, newFile), fe,flw);
938
                            eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), FileUtil.getRelativePath(rootFo, newFile), fe,flw);
938
                        }
939
                        }
939
                    }
940
                    }
940
                    processed = true;
941
                    processed = true;
Lines 964-977 Link Here
964
965
965
                    eventQueue.record(
966
                    eventQueue.record(
966
                            FileEventLog.FileOp.CREATE,
967
                            FileEventLog.FileOp.CREATE,
967
                            root.first,
968
                            root.first(),
968
                            null,
969
                            null,
969
                            fe,
970
                            fe,
970
                            new BinaryWork(root.first,
971
                            new BinaryWork(root.first(),
971
                                suspendSupport.getSuspendStatus(),