diff --git a/cnd.asm/nbproject/project.xml b/cnd.asm/nbproject/project.xml --- a/cnd.asm/nbproject/project.xml +++ b/cnd.asm/nbproject/project.xml @@ -137,7 +137,7 @@ - 8.0 + 8.32 diff --git a/cnd.asm/src/org/netbeans/modules/cnd/asm/core/assistance/GoToLabelAction.java b/cnd.asm/src/org/netbeans/modules/cnd/asm/core/assistance/GoToLabelAction.java --- a/cnd.asm/src/org/netbeans/modules/cnd/asm/core/assistance/GoToLabelAction.java +++ b/cnd.asm/src/org/netbeans/modules/cnd/asm/core/assistance/GoToLabelAction.java @@ -47,7 +47,7 @@ import org.netbeans.modules.cnd.asm.model.AsmState; import org.netbeans.modules.cnd.asm.model.lang.AsmElement; -import org.netbeans.modules.cnd.asm.model.util.Pair; +import org.openide.util.Pair; public class GoToLabelAction { @@ -55,9 +55,9 @@ Pair pair = state.resolveLink(pos); if (pair != null) { - return new int[] { pair.getFirst().getStartOffset(), - pair.getFirst().getEndOffset(), - pair.getSecond().getStartOffset() + return new int[] { pair.first().getStartOffset(), + pair.first().getEndOffset(), + pair.second().getStartOffset() }; } diff --git a/cnd.asm/src/org/netbeans/modules/cnd/asm/core/editor/AsmModelAccessorImpl.java b/cnd.asm/src/org/netbeans/modules/cnd/asm/core/editor/AsmModelAccessorImpl.java --- a/cnd.asm/src/org/netbeans/modules/cnd/asm/core/editor/AsmModelAccessorImpl.java +++ b/cnd.asm/src/org/netbeans/modules/cnd/asm/core/editor/AsmModelAccessorImpl.java @@ -72,7 +72,7 @@ import org.netbeans.modules.cnd.asm.model.lang.syntax.AsmParser; import org.netbeans.modules.cnd.asm.model.util.AsmModelUtilities; import org.netbeans.modules.cnd.asm.model.util.EmptyAsmState; -import org.netbeans.modules.cnd.asm.model.util.Pair; +import org.openide.util.Pair; public class AsmModelAccessorImpl implements AsmModelAccessor { @@ -215,7 +215,7 @@ AsmElement result = resolver.getResult(); if (result != null) { - return Pair.getPair(inital, result); + return Pair.of(inital, result); } } diff --git a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/AsmState.java b/cnd.asm/src/org/netbeans/modules/cnd/asm/model/AsmState.java --- a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/AsmState.java +++ b/cnd.asm/src/org/netbeans/modules/cnd/asm/model/AsmState.java @@ -48,7 +48,7 @@ import org.openide.util.Lookup; import org.netbeans.modules.cnd.asm.model.lang.AsmElement; -import org.netbeans.modules.cnd.asm.model.util.Pair; +import org.openide.util.Pair; public interface AsmState { AsmElement getElements(); diff --git a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/util/EmptyAsmState.java b/cnd.asm/src/org/netbeans/modules/cnd/asm/model/util/EmptyAsmState.java --- a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/util/EmptyAsmState.java +++ b/cnd.asm/src/org/netbeans/modules/cnd/asm/model/util/EmptyAsmState.java @@ -36,6 +36,7 @@ import org.netbeans.modules.cnd.asm.model.AsmState; import org.netbeans.modules.cnd.asm.model.lang.AsmElement; import org.netbeans.modules.cnd.asm.model.lang.impl.LeafAsmElement; +import org.openide.util.Pair; public class EmptyAsmState implements AsmState, AsmFakeable { diff --git a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/util/Pair.java b/cnd.asm/src/org/netbeans/modules/cnd/asm/model/util/Pair.java deleted file mode 100644 --- a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/util/Pair.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun - * Microsystems, Inc. All Rights Reserved. - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - */ - - -package org.netbeans.modules.cnd.asm.model.util; - -public class Pair { - private final T1 p1; - private final T2 p2; - - public Pair(T1 p1, T2 p2) { - this.p1 = p1; - this.p2 = p2; - } - - public T1 getFirst() { - return p1; - } - - public T2 getSecond() { - return p2; - } - - public static Pair getPair(T1 p1, T2 p2) { - return new Pair(p1, p2); - } -} diff --git a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/xml/ModelXMLRootContext.java b/cnd.asm/src/org/netbeans/modules/cnd/asm/model/xml/ModelXMLRootContext.java --- a/cnd.asm/src/org/netbeans/modules/cnd/asm/model/xml/ModelXMLRootContext.java +++ b/cnd.asm/src/org/netbeans/modules/cnd/asm/model/xml/ModelXMLRootContext.java @@ -58,11 +58,11 @@ import org.xml.sax.Attributes; import org.netbeans.modules.cnd.asm.model.lang.BitWidth; -import org.netbeans.modules.cnd.asm.model.util.Pair; import org.netbeans.modules.cnd.asm.model.lang.instruction.Instruction; import org.netbeans.modules.cnd.asm.model.lang.Register; import org.netbeans.modules.cnd.asm.model.lang.instruction.InstructionArgs; import static org.netbeans.modules.cnd.asm.model.xml.ModelXMLAttributes.*; +import org.openide.util.Pair; public class ModelXMLRootContext implements XMLReaderContext { @@ -181,7 +181,7 @@ XMLBaseRegister result = new DefaultXMLBaseRegister(ctx.getName(), ctx.getWidth()); Set children = new HashSet(); for (Pair pair : ctx.getChildren()) { - XMLBaseRegister res = process(getForName(pair.getFirst())); + XMLBaseRegister res = process(getForName(pair.first())); children.addAll(res.getChildren()); children.add(res); res.setDirectParent(result); @@ -230,7 +230,7 @@ String name = checkForName(attributes, REG_NAME_ATTRIBUTE); String offset = checkForName(attributes, REG_OFFSET_ATTRIBUTE); - children.add(new Pair(name, Integer.parseInt(offset))); + children.add(Pair.of(name, Integer.parseInt(offset))); return null; } diff --git a/cnd.repository/nbproject/project.xml b/cnd.repository/nbproject/project.xml --- a/cnd.repository/nbproject/project.xml +++ b/cnd.repository/nbproject/project.xml @@ -43,7 +43,7 @@ - 8.0 + 8.32 diff --git a/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/MemoryCache.java b/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/MemoryCache.java --- a/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/MemoryCache.java +++ b/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/MemoryCache.java @@ -60,8 +60,8 @@ import org.netbeans.modules.cnd.debug.CndTraceFlags; import org.netbeans.modules.cnd.repository.spi.Key; import org.netbeans.modules.cnd.repository.spi.Persistent; -import org.netbeans.modules.cnd.repository.util.Pair; import org.netbeans.modules.cnd.utils.CndUtils; +import org.openide.util.Pair; /** * An in-memory cache for storing repository objects @@ -380,7 +380,7 @@ s.r.unlock(); } if (value instanceof Persistent ) { - result.add(new Pair(key, (Persistent) value)); + result.add(Pair.of(key, (Persistent) value)); s.w.lock(); try { s.storage.remove(key); diff --git a/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/UnitImpl.java b/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/UnitImpl.java --- a/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/UnitImpl.java +++ b/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/UnitImpl.java @@ -56,9 +56,9 @@ import org.netbeans.modules.cnd.repository.spi.Key; import org.netbeans.modules.cnd.repository.spi.Key.Behavior; import org.netbeans.modules.cnd.repository.spi.Persistent; -import org.netbeans.modules.cnd.repository.util.Pair; import org.netbeans.modules.cnd.utils.CndUtils; import org.openide.util.Lookup; +import org.openide.util.Pair; /** * Implements a repository unit @@ -197,7 +197,7 @@ public void close() throws IOException { Collection> hung = cache.clearHungObjects(); for( Pair pair : hung ) { - putPhysically(pair.first, pair.second); + putPhysically(pair.first(), pair.second()); } singleFileStorage.close(); multyFileStorage.close(); diff --git a/cnd.repository/src/org/netbeans/modules/cnd/repository/util/Pair.java b/cnd.repository/src/org/netbeans/modules/cnd/repository/util/Pair.java deleted file mode 100644 --- a/cnd.repository/src/org/netbeans/modules/cnd/repository/util/Pair.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - * - * Contributor(s): - * - * Portions Copyrighted 2008 Sun Microsystems, Inc. - */ - -package org.netbeans.modules.cnd.repository.util; - -/** - * A simple struct, mainly for returning pairs of values - * @author Vladimir Kvashin - */ -public class Pair { - - public final T1 first; - public final T2 second; - - public Pair(T1 first, T2 second) { - this.first = first; - this.second = second; - } - -} diff --git a/csl.api/nbproject/project.xml b/csl.api/nbproject/project.xml --- a/csl.api/nbproject/project.xml +++ b/csl.api/nbproject/project.xml @@ -358,7 +358,7 @@ - 8.0 + 8.32 diff --git a/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/GsfHintsManager.java b/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/GsfHintsManager.java --- a/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/GsfHintsManager.java +++ b/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/GsfHintsManager.java @@ -89,6 +89,7 @@ import org.openide.filesystems.FileUtil; import org.openide.loaders.DataObject; import org.openide.util.Exceptions; +import org.openide.util.Pair; /** * @@ -322,14 +323,14 @@ r = instantiateRule(o); } if ( r != null ) { - rules.add( new Pair( r, o ) ); + rules.add( Pair.of( r, o ) ); } } } Collections.sort(rules, new Comparator>() { @Override public int compare(Pair p1, Pair p2) { - return p1.getA().getDisplayName().compareTo(p2.getA().getDisplayName()); + return p1.first().getDisplayName().compareTo(p2.first().getDisplayName()); } }); return rules; @@ -366,8 +367,8 @@ dir2node.put(rootFolder, rootNode); for( Pair pair : rules ) { - Rule rule = pair.getA(); - FileObject fo = pair.getB(); + Rule rule = pair.first(); + FileObject fo = pair.second(); if ( rule instanceof ErrorRule ) { addRule( (ErrorRule)rule, (Map)dest ); @@ -395,8 +396,8 @@ dir2node.put(rootFolder, rootNode); for( Pair pair : rules ) { - Rule rule = pair.getA(); - FileObject fo = pair.getB(); + Rule rule = pair.first(); + FileObject fo = pair.second(); if ( rule instanceof AstRule ) { @@ -436,8 +437,8 @@ dir2node.put(rootFolder, rootNode); for( Pair pair : rules ) { - Rule rule = pair.getA(); - FileObject fo = pair.getB(); + Rule rule = pair.first(); + FileObject fo = pair.second(); if ( rule instanceof SelectionRule ) { addRule((SelectionRule)rule, (List)dest ); diff --git a/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/Pair.java b/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/Pair.java deleted file mode 100644 --- a/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/Pair.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - */ -package org.netbeans.modules.csl.hints.infrastructure; - -/** - * - * @author Jan Lahoda - */ -public final class Pair { - - private final A a; - private final B b; - - public Pair(A a, B b) { - this.a = a; - this.b = b; - } - - public A getA() { - return a; - } - - public B getB() { - return b; - } - - public static Pair of(A a, B b) { - return new Pair(a, b); - } -} diff --git a/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java b/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java --- a/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java +++ b/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java @@ -173,7 +173,6 @@ import org.netbeans.modules.csl.editor.codetemplates.CslCorePackageAccessor; import org.netbeans.modules.csl.hints.infrastructure.GsfHintsManager; import org.netbeans.modules.csl.hints.infrastructure.HintsSettings; -import org.netbeans.modules.csl.hints.infrastructure.Pair; import org.netbeans.modules.csl.spi.DefaultError; import org.netbeans.modules.csl.spi.GsfUtilities; import org.netbeans.modules.csl.spi.ParserResult; @@ -207,6 +206,7 @@ import org.openide.filesystems.XMLFileSystem; import org.openide.loaders.DataObject; import org.openide.loaders.DataObjectNotFoundException; +import org.openide.util.Pair; import org.openide.util.test.MockLookup; /** @@ -3391,7 +3391,7 @@ } } - return new Pair(history, modifiedText); + return Pair.of(history, modifiedText); } protected final Pair getEditHistory(BaseDocument doc, final EditHistory history, String... edits) throws BadLocationException { @@ -3466,7 +3466,7 @@ } } - return new Pair(history, modifiedText); + return Pair.of(history, modifiedText); } // /** diff --git a/css.editor/manifest.mf b/css.editor/manifest.mf --- a/css.editor/manifest.mf +++ b/css.editor/manifest.mf @@ -2,5 +2,5 @@ OpenIDE-Module: org.netbeans.modules.css.editor/1 OpenIDE-Module-Layer: org/netbeans/modules/css/resources/layer.xml OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 1.52 +OpenIDE-Module-Specification-Version: 1.53 AutoUpdate-Show-In-Client: false diff --git a/css.editor/nbproject/project.xml b/css.editor/nbproject/project.xml --- a/css.editor/nbproject/project.xml +++ b/css.editor/nbproject/project.xml @@ -179,7 +179,7 @@ - 1.28 + 1.46 @@ -259,7 +259,7 @@ - 8.0 + 8.32 diff --git a/css.editor/src/org/netbeans/modules/css/editor/csl/CssDeclarationFinder.java b/css.editor/src/org/netbeans/modules/css/editor/csl/CssDeclarationFinder.java --- a/css.editor/src/org/netbeans/modules/css/editor/csl/CssDeclarationFinder.java +++ b/css.editor/src/org/netbeans/modules/css/editor/csl/CssDeclarationFinder.java @@ -51,7 +51,7 @@ import org.netbeans.modules.css.editor.module.spi.FeatureCancel; import org.netbeans.modules.css.editor.module.spi.FutureParamTask; import org.netbeans.modules.css.lib.api.CssParserResult; -import org.netbeans.modules.web.common.api.Pair; +import org.openide.util.Pair; /** * Hyperlinking for @import declaration only. @@ -80,8 +80,8 @@ public OffsetRange getReferenceSpan(Document doc, int caretOffset) { Pair> declarationLocation = CssModuleSupport.getDeclarationLocation(doc, caretOffset, new FeatureCancel()); if(declarationLocation != null) { - taskRef.set(declarationLocation.getB()); - return declarationLocation.getA(); + taskRef.set(declarationLocation.second()); + return declarationLocation.first(); } return OffsetRange.NONE; } diff --git a/css.editor/src/org/netbeans/modules/css/editor/module/CssModuleSupport.java b/css.editor/src/org/netbeans/modules/css/editor/module/CssModuleSupport.java --- a/css.editor/src/org/netbeans/modules/css/editor/module/CssModuleSupport.java +++ b/css.editor/src/org/netbeans/modules/css/editor/module/CssModuleSupport.java @@ -55,9 +55,9 @@ import org.netbeans.modules.css.lib.api.Node; import org.netbeans.modules.css.lib.api.NodeVisitor; import org.netbeans.modules.css.lib.api.properties.PropertyDefinition; -import org.netbeans.modules.web.common.api.Pair; import org.openide.filesystems.FileObject; import org.openide.util.Lookup; +import org.openide.util.Pair; /** * diff --git a/css.editor/src/org/netbeans/modules/css/editor/module/PropertiesReader.java b/css.editor/src/org/netbeans/modules/css/editor/module/PropertiesReader.java --- a/css.editor/src/org/netbeans/modules/css/editor/module/PropertiesReader.java +++ b/css.editor/src/org/netbeans/modules/css/editor/module/PropertiesReader.java @@ -48,9 +48,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Properties; -import org.netbeans.modules.web.common.api.Pair; + import org.openide.util.Exceptions; import org.openide.util.Lookup; +import org.openide.util.Pair; /** * @@ -152,7 +153,7 @@ } String key = loadConvert(lr.lineBuf, 0, keyLen, convtBuf); String value = loadConvert(lr.lineBuf, valueStart, limit - valueStart, convtBuf); - col.add(new Pair(key, value)); + col.add(Pair.of(key, value)); } } diff --git a/css.editor/src/org/netbeans/modules/css/editor/module/main/DefaultCssEditorModule.java b/css.editor/src/org/netbeans/modules/css/editor/module/main/DefaultCssEditorModule.java --- a/css.editor/src/org/netbeans/modules/css/editor/module/main/DefaultCssEditorModule.java +++ b/css.editor/src/org/netbeans/modules/css/editor/module/main/DefaultCssEditorModule.java @@ -80,10 +80,10 @@ import org.netbeans.modules.parsing.api.Snapshot; import org.netbeans.modules.web.common.api.LexerUtils; import org.netbeans.modules.web.common.api.Lines; -import org.netbeans.modules.web.common.api.Pair; import org.netbeans.modules.web.common.api.WebUtils; import org.openide.filesystems.FileObject; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.lookup.ServiceProvider; /** @@ -479,7 +479,7 @@ } }; - return new Pair>(foundRange, callable); + return Pair.>of(foundRange, callable); } @Override diff --git a/css.editor/src/org/netbeans/modules/css/editor/module/spi/CssEditorModule.java b/css.editor/src/org/netbeans/modules/css/editor/module/spi/CssEditorModule.java --- a/css.editor/src/org/netbeans/modules/css/editor/module/spi/CssEditorModule.java +++ b/css.editor/src/org/netbeans/modules/css/editor/module/spi/CssEditorModule.java @@ -54,8 +54,8 @@ import org.netbeans.modules.csl.api.OffsetRange; import org.netbeans.modules.csl.api.StructureItem; import org.netbeans.modules.css.lib.api.NodeVisitor; -import org.netbeans.modules.web.common.api.Pair; import org.openide.filesystems.FileObject; +import org.openide.util.Pair; /** * The basic class clients wanting to extend the CSS editor functionality needs diff --git a/css.editor/src/org/netbeans/modules/css/editor/module/spi/Utilities.java b/css.editor/src/org/netbeans/modules/css/editor/module/spi/Utilities.java --- a/css.editor/src/org/netbeans/modules/css/editor/module/spi/Utilities.java +++ b/css.editor/src/org/netbeans/modules/css/editor/module/spi/Utilities.java @@ -59,9 +59,9 @@ import org.netbeans.modules.css.lib.api.properties.PropertyDefinition; import org.netbeans.modules.parsing.api.Snapshot; import org.netbeans.modules.web.common.api.LexerUtils; -import org.netbeans.modules.web.common.api.Pair; import org.openide.filesystems.FileObject; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @@ -180,8 +180,8 @@ PropertyCategory category = PropertyCategory.DEFAULT; for(Pair pair : parseBundle) { - String name = pair.getA(); - String value = pair.getB(); + String name = pair.first(); + String value = pair.second(); if(name.startsWith("$")) { //property category diff --git a/css.lib/manifest.mf b/css.lib/manifest.mf --- a/css.lib/manifest.mf +++ b/css.lib/manifest.mf @@ -3,4 +3,4 @@ OpenIDE-Module: org.netbeans.modules.css.lib/1 OpenIDE-Module-Layer: org/netbeans/modules/css/lib/layer.xml OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/lib/Bundle.properties -OpenIDE-Module-Specification-Version: 1.54 +OpenIDE-Module-Specification-Version: 1.55 diff --git a/css.lib/nbproject/project.xml b/css.lib/nbproject/project.xml --- a/css.lib/nbproject/project.xml +++ b/css.lib/nbproject/project.xml @@ -54,7 +54,7 @@ - 1.21 + 1.46 @@ -70,7 +70,7 @@ - 8.18 + 8.32 diff --git a/css.lib/src/org/netbeans/modules/css/lib/api/properties/GrammarResolver.java b/css.lib/src/org/netbeans/modules/css/lib/api/properties/GrammarResolver.java --- a/css.lib/src/org/netbeans/modules/css/lib/api/properties/GrammarResolver.java +++ b/css.lib/src/org/netbeans/modules/css/lib/api/properties/GrammarResolver.java @@ -47,7 +47,7 @@ import java.util.logging.Logger; import static org.netbeans.modules.css.lib.api.properties.GrammarResolver.Log.*; import org.netbeans.modules.css.lib.properties.GrammarParseTreeBuilder; -import org.netbeans.modules.web.common.api.Pair; +import org.openide.util.Pair; /** * Resolves a css property value against its grammar. @@ -328,7 +328,7 @@ } Pair> pair = resolvedSomething.get(lastResolved); - pair.getB().add(valueGrammarElement); + pair.second().add(valueGrammarElement); } private void groupMemberResolved(GrammarElement member, GroupGrammarElement group, InputState state, boolean root) { @@ -340,14 +340,14 @@ if (LOG) { log(ALTERNATIVES, String.format("input matched %s, %s", member.path(), state)); } - resolvedSomething.put(group, new Pair>(state, new LinkedList())); + resolvedSomething.put(group, Pair.>of(state, new LinkedList())); lastResolved = group; } private Set getAlternatives() { HashSet alternatives = new HashSet<>(); for (Pair> tri : resolvedSomething.values()) { - for (ValueGrammarElement value : tri.getB()) { + for (ValueGrammarElement value : tri.second()) { alternatives.add(value); } } diff --git a/css.prep/manifest.mf b/css.prep/manifest.mf --- a/css.prep/manifest.mf +++ b/css.prep/manifest.mf @@ -3,5 +3,5 @@ OpenIDE-Module: org.netbeans.modules.css.prep OpenIDE-Module-Layer: org/netbeans/modules/css/prep/layer.xml OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/css/prep/Bundle.properties -OpenIDE-Module-Specification-Version: 1.10 +OpenIDE-Module-Specification-Version: 1.11 diff --git a/css.prep/nbproject/project.xml b/css.prep/nbproject/project.xml --- a/css.prep/nbproject/project.xml +++ b/css.prep/nbproject/project.xml @@ -47,7 +47,7 @@ 1 - 1.49 + 1.53 @@ -161,7 +161,7 @@ - 1.45 + 1.46 @@ -225,7 +225,7 @@ - 8.30 + 8.32 diff --git a/css.prep/src/org/netbeans/modules/css/prep/editor/CPCssEditorModule.java b/css.prep/src/org/netbeans/modules/css/prep/editor/CPCssEditorModule.java --- a/css.prep/src/org/netbeans/modules/css/prep/editor/CPCssEditorModule.java +++ b/css.prep/src/org/netbeans/modules/css/prep/editor/CPCssEditorModule.java @@ -84,10 +84,10 @@ import org.netbeans.modules.web.common.api.DependencyType; import org.netbeans.modules.web.common.api.LexerUtils; import org.netbeans.modules.web.common.api.Lines; -import org.netbeans.modules.web.common.api.Pair; import org.netbeans.modules.web.common.api.WebUtils; import org.openide.filesystems.FileObject; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.lookup.ServiceProvider; /** @@ -475,7 +475,7 @@ return DeclarationLocation.NONE; } }; - return new Pair>(foundRange, callable); + return Pair.>of(foundRange, callable); case SASS_VAR: case AT_IDENT: //less var //TODO - add default directives - see the css grammar file comment about that @@ -521,7 +521,7 @@ return DeclarationLocation.NONE; } }; - return new Pair>(foundRange, callable); + return Pair.>of(foundRange, callable); default: return null; diff --git a/css.prep/src/org/netbeans/modules/css/prep/util/ExternalExecutable.java b/css.prep/src/org/netbeans/modules/css/prep/util/ExternalExecutable.java --- a/css.prep/src/org/netbeans/modules/css/prep/util/ExternalExecutable.java +++ b/css.prep/src/org/netbeans/modules/css/prep/util/ExternalExecutable.java @@ -70,8 +70,8 @@ import org.netbeans.api.extexecution.input.InputProcessor; import org.netbeans.api.extexecution.input.InputProcessors; import org.netbeans.api.progress.ProgressUtils; -import org.netbeans.modules.web.common.api.Pair; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.Utilities; import org.openide.windows.InputOutput; @@ -126,8 +126,8 @@ */ public ExternalExecutable(String command) { Pair> parsedCommand = parseCommand(command); - executable = parsedCommand.getA(); - parameters = parsedCommand.getB(); + executable = parsedCommand.first(); + parameters = parsedCommand.second(); this.command = command.trim(); } @@ -143,7 +143,7 @@ return Pair.of(tokens[0].trim(), Collections.emptyList()); } Pair> parsedCommand = Pair.of(tokens[0].trim(), Arrays.asList(Utilities.parseParameters(tokens[1].trim()))); - LOGGER.log(Level.FINE, "Parameters parsed: {0} {1}", new Object[] {parsedCommand.getA(), parsedCommand.getB()}); + LOGGER.log(Level.FINE, "Parameters parsed: {0} {1}", new Object[] {parsedCommand.first(), parsedCommand.second()}); return parsedCommand; } diff --git a/css.prep/src/org/netbeans/modules/css/prep/util/ExternalExecutableValidator.java b/css.prep/src/org/netbeans/modules/css/prep/util/ExternalExecutableValidator.java --- a/css.prep/src/org/netbeans/modules/css/prep/util/ExternalExecutableValidator.java +++ b/css.prep/src/org/netbeans/modules/css/prep/util/ExternalExecutableValidator.java @@ -67,7 +67,7 @@ public static String validateCommand(@NullAllowed String command, @NullAllowed String executableName) { String executable = null; if (command != null) { - executable = ExternalExecutable.parseCommand(command).getA(); + executable = ExternalExecutable.parseCommand(command).first(); } if (executableName == null) { return FileUtils.validateFile(executable, false); diff --git a/debugger.jpda.ui/nbproject/project.xml b/debugger.jpda.ui/nbproject/project.xml --- a/debugger.jpda.ui/nbproject/project.xml +++ b/debugger.jpda.ui/nbproject/project.xml @@ -64,7 +64,7 @@ 2 - 2.42 + 2.42 @@ -277,7 +277,7 @@ - 8.0 + 8.32 diff --git a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/ClassBreakpointPanel.java b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/ClassBreakpointPanel.java --- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/ClassBreakpointPanel.java +++ b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/ClassBreakpointPanel.java @@ -62,6 +62,7 @@ import org.openide.NotifyDescriptor; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @author Jan Jancura @@ -119,8 +120,8 @@ ResourceBundle bundle = NbBundle.getBundle(ClassBreakpointPanel.class); String tooltipText = bundle.getString("TTT_TF_Class_Breakpoint_Class_Name"); Pair editorCC = addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText); - spClassName = editorCC.get1(); - epClassName = editorCC.get2(); + spClassName = editorCC.first(); + epClassName = editorCC.second(); epClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName")); epClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Class_Breakpoint_ClassName")); HelpCtx.setHelpIDString(epClassName, HELP_ID); @@ -347,7 +348,7 @@ } sle.setToolTipText(tooltipText); epClassName.setToolTipText(tooltipText); - return new Pair(sle, epClassName); + return Pair.of(sle, epClassName); } // Variables declaration - do not modify//GEN-BEGIN:variables diff --git a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/ExceptionBreakpointPanel.java b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/ExceptionBreakpointPanel.java --- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/ExceptionBreakpointPanel.java +++ b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/ExceptionBreakpointPanel.java @@ -59,6 +59,7 @@ import org.openide.NotifyDescriptor; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** @@ -114,8 +115,8 @@ String tooltipText = bundle.getString("TTT_TF_Field_Breakpoint_Class_Name"); Pair editorCC = ClassBreakpointPanel.addClassNameEditorCC( ExceptionClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText); - spExceptionClassName = editorCC.get1(); - epExceptionClassName = editorCC.get2(); + spExceptionClassName = editorCC.first(); + epExceptionClassName = editorCC.second(); epExceptionClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName")); epExceptionClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Exception_Breakpoint_ClassName")); HelpCtx.setHelpIDString(epExceptionClassName, HELP_ID); diff --git a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/FieldBreakpointPanel.java b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/FieldBreakpointPanel.java --- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/FieldBreakpointPanel.java +++ b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/FieldBreakpointPanel.java @@ -62,6 +62,7 @@ import org.openide.NotifyDescriptor; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @author Jan Jancura @@ -124,16 +125,16 @@ ResourceBundle bundle = NbBundle.getBundle(FieldBreakpointPanel.class); String tooltipText = bundle.getString("TTT_TF_Field_Breakpoint_Class_Name"); Pair editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText); - spClassName = editorCC.get1(); - epClassName = editorCC.get2(); + spClassName = editorCC.first(); + epClassName = editorCC.second(); epClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName")); epClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Field_Breakpoint_ClassName")); HelpCtx.setHelpIDString(epClassName, HELP_ID); jLabel3.setLabelFor(spClassName); editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaFieldNbDebugEditorKit.MIME_TYPE, null, b.getFieldName(), bundle.getString("TTT_TF_Field_Breakpoint_Field_Name")); - spFieldName = editorCC.get1(); - epFieldName = editorCC.get2(); + spFieldName = editorCC.first(); + epFieldName = editorCC.second(); jLabel1.setLabelFor(spFieldName); java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); diff --git a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/MethodBreakpointPanel.java b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/MethodBreakpointPanel.java --- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/MethodBreakpointPanel.java +++ b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/MethodBreakpointPanel.java @@ -60,6 +60,7 @@ import org.openide.ErrorManager; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @author Jan Jancura @@ -126,8 +127,8 @@ className = ClassBreakpointPanel.concatClassFilters(cf); String tooltipText = NbBundle.getMessage(MethodBreakpointPanel.class, "TTT_TF_Field_Breakpoint_Class_Name"); Pair editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaClassNbDebugEditorKit.MIME_TYPE, null, className, tooltipText); - spClassName = editorCC.get1(); - epClassName = editorCC.get2(); + spClassName = editorCC.first(); + epClassName = editorCC.second(); epClassName.getAccessibleContext().setAccessibleName(NbBundle.getMessage(MethodBreakpointPanel.class, "ACSN_Method_Breakpoint_ClassName")); epClassName.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(MethodBreakpointPanel.class, "ACSD_Method_Breakpoint_ClassName")); jLabel3.setLabelFor(spClassName); @@ -135,8 +136,8 @@ panelClassName.add(java.awt.BorderLayout.CENTER, spClassName); editorCC = ClassBreakpointPanel.addClassNameEditorCC(JavaMethodNbDebugEditorKit.MIME_TYPE, null, className, org.openide.util.NbBundle.getMessage(MethodBreakpointPanel.class, "TTT_TF_Method_Breakpoint_Method_Name")); - spMethodName = editorCC.get1(); - epMethodName = editorCC.get2(); + spMethodName = editorCC.first(); + epMethodName = editorCC.second(); jLabel1.setLabelFor(spMethodName); java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; diff --git a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/Pair.java b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/Pair.java deleted file mode 100644 --- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/Pair.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2012 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - * - * Contributor(s): - * - * Portions Copyrighted 2012 Sun Microsystems, Inc. - */ -package org.netbeans.modules.debugger.jpda.ui.breakpoints; - -/** - * A pair of values - * - * @author Martin Entlicher - */ -final class Pair { - - private final T1 o1; - private final T2 o2; - - public Pair(final T1 o1, final T2 o2) { - this.o1 = o1; - this.o2 = o2; - } - - public T1 get1() { - return o1; - } - - public T2 get2() { - return o2; - } - -} diff --git a/html.editor/manifest.mf b/html.editor/manifest.mf --- a/html.editor/manifest.mf +++ b/html.editor/manifest.mf @@ -2,5 +2,5 @@ OpenIDE-Module: org.netbeans.modules.html.editor/2 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/html/editor/resources/Bundle.properties OpenIDE-Module-Layer: org/netbeans/modules/html/editor/resources/layer.xml -OpenIDE-Module-Specification-Version: 2.19 +OpenIDE-Module-Specification-Version: 2.20 AutoUpdate-Show-In-Client: false diff --git a/html.editor/nbproject/project.xml b/html.editor/nbproject/project.xml --- a/html.editor/nbproject/project.xml +++ b/html.editor/nbproject/project.xml @@ -276,7 +276,7 @@ - 1.12 + 1.46 @@ -365,7 +365,7 @@ - 8.0 + 8.32 diff --git a/html.editor/src/org/netbeans/modules/html/editor/gsf/HtmlStructureScanner.java b/html.editor/src/org/netbeans/modules/html/editor/gsf/HtmlStructureScanner.java --- a/html.editor/src/org/netbeans/modules/html/editor/gsf/HtmlStructureScanner.java +++ b/html.editor/src/org/netbeans/modules/html/editor/gsf/HtmlStructureScanner.java @@ -57,10 +57,10 @@ import org.netbeans.modules.html.editor.api.gsf.HtmlParserResult; import org.netbeans.modules.html.editor.lib.api.elements.*; import org.netbeans.modules.parsing.api.Snapshot; -import org.netbeans.modules.web.common.api.Pair; import org.openide.filesystems.FileObject; import org.openide.util.NbBundle; import static org.netbeans.modules.html.editor.gsf.Bundle.*; +import org.openide.util.Pair; /** * @@ -99,8 +99,8 @@ if (cache != null) { Pair> pair = cache.get(); if (pair != null) { - if (info == pair.getA()) { - return pair.getB(); + if (info == pair.first()) { + return pair.second(); } } } @@ -119,15 +119,15 @@ Snapshot snapshot = info.getSnapshot(); FileObject file = snapshot.getSource().getFileObject(); - List elements = new ArrayList(); + List elements = new ArrayList(); for(OpenTag tag : root.children(OpenTag.class)) { HtmlElementHandle handle = new HtmlElementHandle(tag, file); - StructureItem si = new HtmlStructureItem(tag, handle, snapshot); + HtmlStructureItem si = new HtmlStructureItem(tag, handle, snapshot); elements.add(si); } //cache - Pair> pair = new Pair(info, elements); + Pair> pair = Pair.of(info, elements); cache = new WeakReference>>(pair); return elements; diff --git a/java.hints/nbproject/project.xml b/java.hints/nbproject/project.xml --- a/java.hints/nbproject/project.xml +++ b/java.hints/nbproject/project.xml @@ -425,7 +425,7 @@ - 8.10 + 8.32 diff --git a/java.hints/src/org/netbeans/modules/java/hints/ConvertAnonymousToInner.java b/java.hints/src/org/netbeans/modules/java/hints/ConvertAnonymousToInner.java --- a/java.hints/src/org/netbeans/modules/java/hints/ConvertAnonymousToInner.java +++ b/java.hints/src/org/netbeans/modules/java/hints/ConvertAnonymousToInner.java @@ -83,7 +83,6 @@ import org.netbeans.api.java.source.support.SelectionAwareJavaSourceTaskFactory; import org.netbeans.modules.java.editor.rename.InstantRenamePerformer; import org.netbeans.modules.java.hints.errors.Utilities; -import org.netbeans.modules.java.hints.infrastructure.Pair; import org.netbeans.modules.java.hints.spi.AbstractHint; import org.netbeans.spi.editor.hints.ChangeInfo; import org.netbeans.spi.editor.hints.ErrorDescription; @@ -96,6 +95,7 @@ import org.openide.loaders.DataObjectNotFoundException; import org.openide.util.Exceptions; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @@ -491,8 +491,8 @@ if (resolvedArguments != null) { nueSuperConstructorCallRealArguments = new LinkedList(); - Iterator typeIt = resolvedArguments.getA().iterator(); - Iterator nameIt = resolvedArguments.getB().iterator(); + Iterator typeIt = resolvedArguments.first().iterator(); + Iterator nameIt = resolvedArguments.second().iterator(); while (typeIt.hasNext() && nameIt.hasNext()) { TypeMirror tm = typeIt.next(); diff --git a/java.hints/src/org/netbeans/modules/java/hints/bugs/UnusedAssignmentOrBranch.java b/java.hints/src/org/netbeans/modules/java/hints/bugs/UnusedAssignmentOrBranch.java --- a/java.hints/src/org/netbeans/modules/java/hints/bugs/UnusedAssignmentOrBranch.java +++ b/java.hints/src/org/netbeans/modules/java/hints/bugs/UnusedAssignmentOrBranch.java @@ -57,7 +57,6 @@ import org.netbeans.api.java.source.CompilationInfo; import org.netbeans.api.java.source.CompilationInfo.CacheClearPolicy; import org.netbeans.api.java.source.support.CancellableTreePathScanner; -import org.netbeans.modules.java.hints.infrastructure.Pair; import org.netbeans.modules.java.hints.introduce.Flow; import org.netbeans.modules.java.hints.introduce.Flow.FlowResult; import org.netbeans.spi.java.hints.Hint; @@ -69,6 +68,7 @@ import org.netbeans.spi.java.hints.TriggerPattern; import org.netbeans.spi.java.hints.TriggerPatterns; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @@ -136,7 +136,7 @@ } }.scan(info.getCompilationUnit(), null); - info.putCachedValue(KEY_COMPUTED_ASSIGNMENTS, result = new Pair, Set>(usedAssignments, usedVariables), CacheClearPolicy.ON_TASK_END); + info.putCachedValue(KEY_COMPUTED_ASSIGNMENTS, result = Pair., Set>of(usedAssignments, usedVariables), CacheClearPolicy.ON_TASK_END); return result; } @@ -155,8 +155,8 @@ if (ctx.isCanceled() || computedAssignments == null) return null; final CompilationInfo info = ctx.getInfo(); - final Set usedAssignments = computedAssignments.getA(); - final Set usedVariables = computedAssignments.getB(); + final Set usedAssignments = computedAssignments.first(); + final Set usedVariables = computedAssignments.second(); Element var = info.getTrees().getElement(ctx.getVariables().get("$var")); Tree value = ctx.getVariables().get("$value").getLeaf(); diff --git a/java.hints/src/org/netbeans/modules/java/hints/errors/ChangeMethodParameters.java b/java.hints/src/org/netbeans/modules/java/hints/errors/ChangeMethodParameters.java --- a/java.hints/src/org/netbeans/modules/java/hints/errors/ChangeMethodParameters.java +++ b/java.hints/src/org/netbeans/modules/java/hints/errors/ChangeMethodParameters.java @@ -52,7 +52,6 @@ import org.netbeans.api.java.source.TreePathHandle; import org.netbeans.api.java.source.TreeUtilities; import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider; -import org.netbeans.modules.java.hints.infrastructure.Pair; import org.netbeans.modules.java.hints.spi.ErrorRule; import org.netbeans.modules.java.hints.spi.ErrorRule.Data; import org.netbeans.modules.refactoring.java.api.ChangeParametersRefactoring; @@ -60,6 +59,7 @@ import org.netbeans.spi.editor.hints.Fix; import org.openide.util.Exceptions; import org.openide.util.NbBundle; +import org.openide.util.Pair; public class ChangeMethodParameters implements ErrorRule { diff --git a/java.hints/src/org/netbeans/modules/java/hints/errors/CreateElement.java b/java.hints/src/org/netbeans/modules/java/hints/errors/CreateElement.java --- a/java.hints/src/org/netbeans/modules/java/hints/errors/CreateElement.java +++ b/java.hints/src/org/netbeans/modules/java/hints/errors/CreateElement.java @@ -85,7 +85,6 @@ import org.netbeans.modules.java.hints.errors.CreateClassFix.CreateInnerClassFix; import org.netbeans.modules.java.hints.errors.CreateClassFix.CreateOuterClassFix; import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider; -import org.netbeans.modules.java.hints.infrastructure.Pair; import org.netbeans.modules.java.hints.spi.ErrorRule; import org.netbeans.spi.editor.hints.Fix; import org.openide.ErrorManager; @@ -96,6 +95,7 @@ import static org.netbeans.modules.java.hints.errors.CreateElementUtilities.*; import org.netbeans.modules.java.hints.errors.ErrorFixesFakeHint.FixKind; import org.netbeans.modules.java.hints.errors.Utilities.MethodArguments; +import org.openide.util.Pair; /** * @@ -449,7 +449,7 @@ } private static List prepareCreateOuterClassFix(CompilationInfo info, TreePath invocation, Element source, Set modifiers, String simpleName, List realArguments, TypeMirror superType, ElementKind kind, int numTypeParameters) { - Pair, List> formalArguments = invocation != null ? Utilities.resolveArguments(info, invocation, realArguments, null) : new Pair, List>(null, null); + Pair, List> formalArguments = invocation != null ? Utilities.resolveArguments(info, invocation, realArguments, null) : Pair., List>of(null, null); if (formalArguments == null) { return Collections.emptyList(); @@ -464,11 +464,11 @@ PackageElement packageElement = (PackageElement) (source instanceof PackageElement ? source : info.getElementUtilities().outermostTypeElement(source).getEnclosingElement()); - return Collections.singletonList(new CreateOuterClassFix(info, root, packageElement.getQualifiedName().toString(), simpleName, modifiers, formalArguments.getA(), formalArguments.getB(), superType, kind, numTypeParameters)); + return Collections.singletonList(new CreateOuterClassFix(info, root, packageElement.getQualifiedName().toString(), simpleName, modifiers, formalArguments.first(), formalArguments.second(), superType, kind, numTypeParameters)); } private static List prepareCreateInnerClassFix(CompilationInfo info, TreePath invocation, TypeElement target, Set modifiers, String simpleName, List realArguments, TypeMirror superType, ElementKind kind, int numTypeParameters) { - Pair, List> formalArguments = invocation != null ? Utilities.resolveArguments(info, invocation, realArguments, target) : new Pair, List>(null, null); + Pair, List> formalArguments = invocation != null ? Utilities.resolveArguments(info, invocation, realArguments, target) : Pair., List>of(null, null); if (formalArguments == null) { return Collections.emptyList(); @@ -483,7 +483,7 @@ if (targetFile == null) return Collections.emptyList(); - return Collections.singletonList(new CreateInnerClassFix(info, simpleName, modifiers, target, formalArguments.getA(), formalArguments.getB(), superType, kind, numTypeParameters, targetFile)); + return Collections.singletonList(new CreateInnerClassFix(info, simpleName, modifiers, target, formalArguments.first(), formalArguments.second(), superType, kind, numTypeParameters, targetFile)); } private static ElementKind getClassType(Set types) { diff --git a/java.hints/src/org/netbeans/modules/java/hints/errors/ImportClass.java b/java.hints/src/org/netbeans/modules/java/hints/errors/ImportClass.java --- a/java.hints/src/org/netbeans/modules/java/hints/errors/ImportClass.java +++ b/java.hints/src/org/netbeans/modules/java/hints/errors/ImportClass.java @@ -85,7 +85,6 @@ import org.netbeans.modules.java.hints.errors.ImportClass.ImportCandidatesHolder; import org.netbeans.modules.java.hints.infrastructure.CreatorBasedLazyFixList; import org.netbeans.modules.java.hints.infrastructure.ErrorHintsProvider; -import org.netbeans.modules.java.hints.infrastructure.Pair; import org.netbeans.modules.java.hints.spi.ErrorRule; import org.netbeans.modules.java.preprocessorbridge.spi.ImportProcessor; import org.netbeans.spi.editor.hints.ChangeInfo; @@ -100,6 +99,7 @@ import org.openide.util.Lookup; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; +import org.openide.util.Pair; import org.openide.util.RequestProcessor; @@ -160,7 +160,7 @@ Element el = info.getTrees().getElement(new TreePath(new TreePath(new TreePath(info.getCompilationUnit()), it), it.getQualifiedIdentifier())); if (candidates != null && el != null) { - List a = candidates.getA(); + List a = candidates.first(); if (a != null && a.contains(el)) { return Collections.emptyList(); } @@ -179,8 +179,8 @@ imp = imp.getParentPath(); } - List filtered = candidates.getA(); - List unfiltered = candidates.getB(); + List filtered = candidates.first(); + List unfiltered = candidates.second(); List fixes = new ArrayList(); if (unfiltered != null && filtered != null) { @@ -264,7 +264,7 @@ Pair>, Map>> result = holder.getCandidates(); - if (result == null || result.getA() == null || result.getB() == null) { + if (result == null || result.first() == null || result.second() == null) { //compute imports: Map> candidates = new HashMap>(); ComputeImports imp = new ComputeImports(); @@ -303,15 +303,15 @@ notFilteredCandidates.put(sn, c); } - result = new Pair>, Map>>(rawCandidates.a, rawCandidates.b); + result = Pair.>, Map>>of(rawCandidates.a, rawCandidates.b); holder.setCandidates(result); } - List candList = result.getA().get(simpleName); - List notFilteredCandList = result.getB().get(simpleName); + List candList = result.first().get(simpleName); + List notFilteredCandList = result.second().get(simpleName); - return new Pair(candList, notFilteredCandList); + return Pair., List>of(candList, notFilteredCandList); } public static class ImportCandidatesHolder { diff --git a/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java b/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java --- a/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java +++ b/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java @@ -59,7 +59,6 @@ import org.netbeans.api.java.source.TreeUtilities; import org.openide.filesystems.FileUtil; import org.openide.util.NbBundle; -import org.netbeans.modules.java.hints.infrastructure.Pair; import com.sun.source.tree.ArrayAccessTree; import com.sun.source.tree.ArrayTypeTree; import com.sun.source.tree.BinaryTree; @@ -138,6 +137,7 @@ import org.openide.util.Exceptions; import static com.sun.source.tree.Tree.Kind.*; +import org.openide.util.Pair; /** * @@ -880,7 +880,7 @@ if (ma == null) return null; - return new Pair, List>(ma.parameterTypes, ma.parameterNames); + return Pair., List>of(ma.parameterTypes, ma.parameterNames); } public static MethodArguments resolveArguments(CompilationInfo info, TreePath invocation, List realArguments, Element target, TypeMirror returnType) { diff --git a/java.hints/src/org/netbeans/modules/java/hints/infrastructure/Pair.java b/java.hints/src/org/netbeans/modules/java/hints/infrastructure/Pair.java deleted file mode 100644 --- a/java.hints/src/org/netbeans/modules/java/hints/infrastructure/Pair.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun - * Microsystems, Inc. All Rights Reserved. - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - */ - -package org.netbeans.modules.java.hints.infrastructure; - -/** - * - * @author Jan Lahoda - */ -public final class Pair { - - private A a; - private B b; - - public Pair(A a, B b) { - this.a = a; - this.b = b; - } - - public A getA() { - return a; - } - - public B getB() { - return b; - } - - @Override - public String toString() { - return "[" + String.valueOf(a) + "/" + String.valueOf(b) + "]"; - } -} diff --git a/java.hints/src/org/netbeans/modules/java/hints/jackpot/hintsimpl/ForbiddenMethod.java b/java.hints/src/org/netbeans/modules/java/hints/jackpot/hintsimpl/ForbiddenMethod.java --- a/java.hints/src/org/netbeans/modules/java/hints/jackpot/hintsimpl/ForbiddenMethod.java +++ b/java.hints/src/org/netbeans/modules/java/hints/jackpot/hintsimpl/ForbiddenMethod.java @@ -55,8 +55,8 @@ import org.netbeans.spi.java.hints.TriggerTreeKind; import org.netbeans.spi.java.hints.HintContext; import org.netbeans.spi.java.hints.ErrorDescriptionFactory; -import org.netbeans.modules.java.hints.infrastructure.Pair; import org.netbeans.spi.editor.hints.ErrorDescription; +import org.openide.util.Pair; /** * @@ -69,7 +69,7 @@ static { map = new HashMap>(); - map.put("exit", new Pair("System", "Non-portable")); + map.put("exit", Pair.of("System", "Non-portable")); } @TriggerTreeKind(Tree.Kind.METHOD_INVOCATION) @@ -86,8 +86,8 @@ String parent = e.getEnclosingElement().getSimpleName().toString(); Pair pair = map.get(simpleName); - if (pair != null && pair.getA().equals(parent)) { - return ErrorDescriptionFactory.forName(ctx, mit, pair.getB()); + if (pair != null && pair.first().equals(parent)) { + return ErrorDescriptionFactory.forName(ctx, mit, pair.second()); } diff --git a/java.j2seprofiles/nbproject/project.xml b/java.j2seprofiles/nbproject/project.xml --- a/java.j2seprofiles/nbproject/project.xml +++ b/java.j2seprofiles/nbproject/project.xml @@ -139,7 +139,7 @@ - 8.31 + 8.32 diff --git a/java.j2seprofiles/src/org/netbeans/modules/java/j2seprofiles/Pair.java b/java.j2seprofiles/src/org/netbeans/modules/java/j2seprofiles/Pair.java deleted file mode 100644 --- a/java.j2seprofiles/src/org/netbeans/modules/java/j2seprofiles/Pair.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - * - * Contributor(s): - * - * Portions Copyrighted 2009 Sun Microsystems, Inc. - */ - -package org.netbeans.modules.java.j2seprofiles; - -/** - * Just another copy of Pair. - * @author Tomas Zezula - */ -final class Pair { - - public final P first; - public final K second; - - private Pair (P first, K second) { - this.first = first; - this.second = second; - } - - - public static Pair of (P first, K second) { - return new Pair (first,second); - } - - - @Override - public int hashCode () { - int hashCode = 0; - hashCode ^= first == null ? 0 : first.hashCode(); - hashCode ^= second == null ? 0: second.hashCode(); - return hashCode; - } - - @Override - public boolean equals (final Object other) { - if (other instanceof Pair) { - Pair otherPair = (Pair) other; - return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) && - (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second)); - } - return false; - } - - @Override - public String toString () { - return String.format("Pair[%s,%s]", first,second); - } -} diff --git a/java.j2seprofiles/src/org/netbeans/modules/java/j2seprofiles/ProfilesAnalyzer.java b/java.j2seprofiles/src/org/netbeans/modules/java/j2seprofiles/ProfilesAnalyzer.java --- a/java.j2seprofiles/src/org/netbeans/modules/java/j2seprofiles/ProfilesAnalyzer.java +++ b/java.j2seprofiles/src/org/netbeans/modules/java/j2seprofiles/ProfilesAnalyzer.java @@ -107,6 +107,7 @@ import org.openide.filesystems.FileUtil; import org.openide.filesystems.URLMapper; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.lookup.ServiceProvider; /** @@ -188,7 +189,7 @@ filterForRoot = Pair.,Set>of(new HashSet(), new HashSet()); filter.put(ownerRoot, filterForRoot); } - filterForRoot.first.add(f); + filterForRoot.first().add(f); } } for (FileObject f : scope.getFiles()) { @@ -200,7 +201,7 @@ filterForRoot = Pair.,Set>of(new HashSet(), new HashSet()); filter.put(ownerRoot, filterForRoot); } - filterForRoot.second.add(f); + filterForRoot.second().add(f); } } final ProfileProvider pp = new ProfileProvider(context); @@ -249,13 +250,13 @@ if (canceled.get()) { break; } - final URI rootURI = violationsPair.first.first; - final Set projects = submittedBinaries.remove(violationsPair.first); + final URI rootURI = violationsPair.first().first(); + final Set projects = submittedBinaries.remove(violationsPair.first()); final boolean binary = projects != null; if (!binary) { submittedSources.remove(rootURI); } - final Collection violations = violationsPair.second; + final Collection violations = violationsPair.second(); if (violations.isEmpty()) { continue; } @@ -526,10 +527,10 @@ if (filter == null) { return true; } - if (filter.second.contains(source)) { + if (filter.second().contains(source)) { return true; } - for (FileObject folder : filter.first) { + for (FileObject folder : filter.first()) { if (folder.equals(source.getParent())) { return true; } diff --git a/java.navigation/nbproject/project.xml b/java.navigation/nbproject/project.xml --- a/java.navigation/nbproject/project.xml +++ b/java.navigation/nbproject/project.xml @@ -296,7 +296,7 @@ - 8.0 + 8.32 diff --git a/java.navigation/src/org/netbeans/modules/java/navigation/ClassMemberPanelUI.java b/java.navigation/src/org/netbeans/modules/java/navigation/ClassMemberPanelUI.java --- a/java.navigation/src/org/netbeans/modules/java/navigation/ClassMemberPanelUI.java +++ b/java.navigation/src/org/netbeans/modules/java/navigation/ClassMemberPanelUI.java @@ -96,7 +96,6 @@ import org.netbeans.modules.java.navigation.actions.SortActions; import org.netbeans.modules.java.navigation.base.FiltersManager; import org.netbeans.modules.java.navigation.base.HistorySupport; -import org.netbeans.modules.java.navigation.base.Pair; import org.netbeans.modules.java.navigation.base.Resolvers; import org.netbeans.modules.java.navigation.base.SelectJavadocTask; import org.openide.nodes.Node; @@ -117,6 +116,7 @@ import org.openide.util.Lookup; import org.openide.util.Mutex; import org.openide.util.NbPreferences; +import org.openide.util.Pair; import org.openide.util.RequestProcessor; import org.openide.util.lookup.AbstractLookup; import org.openide.util.lookup.InstanceContent; @@ -756,7 +756,7 @@ try { final Pair> handlePair = becomesHandle.get(); if (handlePair != null) { - final FileObject target = URLMapper.findFileObject(handlePair.first.toURL()); + final FileObject target = URLMapper.findFileObject(handlePair.first().toURL()); if (target != null) { final JavaSource targetJs = JavaSource.forFileObject(target); if (targetJs != null) { @@ -766,12 +766,12 @@ } else { clearNodes(); StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File( - handlePair.second.getQualifiedName())); + handlePair.second().getQualifiedName())); } } else { clearNodes(); StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File( - handlePair.second.getQualifiedName())); + handlePair.second().getQualifiedName())); } } else { clearNodes(); diff --git a/java.navigation/src/org/netbeans/modules/java/navigation/base/HistorySupport.java b/java.navigation/src/org/netbeans/modules/java/navigation/base/HistorySupport.java --- a/java.navigation/src/org/netbeans/modules/java/navigation/base/HistorySupport.java +++ b/java.navigation/src/org/netbeans/modules/java/navigation/base/HistorySupport.java @@ -68,6 +68,7 @@ import org.netbeans.api.annotations.common.NullAllowed; import org.netbeans.api.java.source.ElementHandle; import org.openide.util.Mutex; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.WeakListeners; @@ -181,8 +182,8 @@ @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { String toolTipText = null; - if (value instanceof Pair && ((Pair)value).second instanceof ElementHandle) { - final String fqn = ((ElementHandle)((Pair)value).second).getQualifiedName(); + if (value instanceof Pair && ((Pair)value).second() instanceof ElementHandle) { + final String fqn = ((ElementHandle)((Pair)value).second()).getQualifiedName(); value = getSimpleName(fqn); toolTipText = fqn; } @@ -291,8 +292,8 @@ @Override public int compare(Pair> o1, Pair> o2) { - final String q1 = o1.second.getQualifiedName(); - final String q2 = o2.second.getQualifiedName(); + final String q1 = o1.second().getQualifiedName(); + final String q2 = o2.second().getQualifiedName(); final String simpleName1 = getSimpleName(q1); final String simpleName2 = getSimpleName(q2); int res = simpleName1.compareTo(simpleName2); diff --git a/java.navigation/src/org/netbeans/modules/java/navigation/base/Pair.java b/java.navigation/src/org/netbeans/modules/java/navigation/base/Pair.java deleted file mode 100644 --- a/java.navigation/src/org/netbeans/modules/java/navigation/base/Pair.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * Contributor(s): - * - * Portions Copyrighted 2007 Sun Microsystems, Inc. - */ -package org.netbeans.modules.java.navigation.base; - -/** - * - * @author Tomas Zezula - */ -public final class Pair { - - public final P first; - public final K second; - - private Pair (P first, K second) { - this.first = first; - this.second = second; - } - - - public static Pair of (P first, K second) { - return new Pair (first,second); - } - - - @Override - public int hashCode () { - int hashCode = 0; - hashCode ^= first == null ? 0 : first.hashCode(); - hashCode ^= second == null ? 0: second.hashCode(); - return hashCode; - } - - @Override - public boolean equals (final Object other) { - if (other instanceof Pair) { - Pair otherPair = (Pair) other; - return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) && - (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second)); - } - return false; - } - - @Override - public String toString () { - return String.format("Pair[%s,%s]", first,second); - } -} diff --git a/java.navigation/src/org/netbeans/modules/java/navigation/base/Resolvers.java b/java.navigation/src/org/netbeans/modules/java/navigation/base/Resolvers.java --- a/java.navigation/src/org/netbeans/modules/java/navigation/base/Resolvers.java +++ b/java.navigation/src/org/netbeans/modules/java/navigation/base/Resolvers.java @@ -63,6 +63,7 @@ import org.netbeans.api.java.source.JavaSource; import org.netbeans.api.java.source.Task; import org.openide.filesystems.FileObject; +import org.openide.util.Pair; import org.openide.util.Parameters; /** diff --git a/java.navigation/src/org/netbeans/modules/java/navigation/base/SelectJavadocTask.java b/java.navigation/src/org/netbeans/modules/java/navigation/base/SelectJavadocTask.java --- a/java.navigation/src/org/netbeans/modules/java/navigation/base/SelectJavadocTask.java +++ b/java.navigation/src/org/netbeans/modules/java/navigation/base/SelectJavadocTask.java @@ -58,6 +58,7 @@ import org.openide.nodes.Node; import org.openide.util.Exceptions; import org.openide.util.Lookup; +import org.openide.util.Pair; import org.openide.util.Parameters; /** @@ -90,7 +91,7 @@ final JavadocTopComponent tc = JavadocTopComponent.findInstance(); if (tc != null) { tc.open(); - tc.setJavadoc(documentation.first,documentation.second); + tc.setJavadoc(documentation.first(),documentation.second()); } } }); diff --git a/java.navigation/src/org/netbeans/modules/java/navigation/hierarchy/HierarchyTopComponent.java b/java.navigation/src/org/netbeans/modules/java/navigation/hierarchy/HierarchyTopComponent.java --- a/java.navigation/src/org/netbeans/modules/java/navigation/hierarchy/HierarchyTopComponent.java +++ b/java.navigation/src/org/netbeans/modules/java/navigation/hierarchy/HierarchyTopComponent.java @@ -95,7 +95,6 @@ import org.netbeans.modules.java.navigation.JavadocTopComponent; import org.netbeans.modules.java.navigation.NoBorderToolBar; import org.netbeans.modules.java.navigation.base.HistorySupport; -import org.netbeans.modules.java.navigation.base.Pair; import org.netbeans.modules.java.navigation.base.Resolvers; import org.netbeans.modules.java.navigation.base.SelectJavadocTask; import org.netbeans.modules.java.navigation.base.TapPanel; @@ -116,6 +115,7 @@ import org.openide.util.NbPreferences; import org.openide.windows.TopComponent; import org.openide.util.NbBundle.Messages; +import org.openide.util.Pair; import org.openide.util.RequestProcessor; import org.openide.util.lookup.AbstractLookup; import org.openide.util.lookup.InstanceContent; @@ -530,20 +530,20 @@ final Pair> pair = toShow.get(); if (pair != null) { if (viewType == ViewType.SUB_TYPE && - Object.class.getName().equals(pair.second.getQualifiedName())) { + Object.class.getName().equals(pair.second().getQualifiedName())) { nonActiveInfo.setText(Bundle.WARN_Object()); ((CardLayout)contentView.getLayout()).show(contentView, NON_ACTIVE_CONTENT); } else { - final FileObject file = URLMapper.findFileObject(pair.first.toURL()); + final FileObject file = URLMapper.findFileObject(pair.first().toURL()); JavaSource js; if (file != null && (js=JavaSource.forFileObject(file)) != null) { - LOG.log(Level.FINE, "Showing hierarchy for: {0}", pair.second.getQualifiedName()); //NOI18N + LOG.log(Level.FINE, "Showing hierarchy for: {0}", pair.second().getQualifiedName()); //NOI18N history.addToHistory(pair); js.runUserActionTask(new Task() { @Override public void run(CompilationController cc) throws Exception { cc.toPhase(Phase.ELEMENTS_RESOLVED); - final TypeElement te = pair.second.resolve(cc); + final TypeElement te = pair.second().resolve(cc); if (te != null) { final Node root; if (viewType == ViewType.SUPER_TYPE) { @@ -583,7 +583,7 @@ }, true); } else { rootChildren.set(null); - StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(pair.second.getQualifiedName())); + StatusDisplayer.getDefault().setStatusText(Bundle.ERR_Cannot_Resolve_File(pair.second().getQualifiedName())); } } } else { @@ -642,7 +642,7 @@ toolbar.setFocusable(false); toolbar.setLayout(new GridBagLayout()); for (Pair p : components) { - toolbar.add(p.first,p.second); + toolbar.add(p.first(),p.second()); } add (toolbar); } diff --git a/java.source/nbproject/project.xml b/java.source/nbproject/project.xml --- a/java.source/nbproject/project.xml +++ b/java.source/nbproject/project.xml @@ -383,7 +383,7 @@ - 8.25 + 8.32 diff --git a/java.source/src/org/netbeans/api/java/source/CompilationInfo.java b/java.source/src/org/netbeans/api/java/source/CompilationInfo.java --- a/java.source/src/org/netbeans/api/java/source/CompilationInfo.java +++ b/java.source/src/org/netbeans/api/java/source/CompilationInfo.java @@ -75,13 +75,13 @@ import org.netbeans.modules.java.source.parsing.FileObjects; import org.netbeans.modules.java.source.parsing.JavacParser; import org.netbeans.modules.java.source.parsing.JavacParserResult; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.modules.parsing.api.Snapshot; import org.netbeans.modules.parsing.spi.Parser; import org.openide.cookies.EditorCookie; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.loaders.DataObject; +import org.openide.util.Pair; import org.openide.util.Parameters; /** Assorted information about the JavaSource. @@ -171,7 +171,7 @@ if (cu == null) { return null; } - return TreePath.getPath(cu, changedTree.second); + return TreePath.getPath(cu, changedTree.second()); } /** diff --git a/java.source/src/org/netbeans/api/java/source/SourceUtils.java b/java.source/src/org/netbeans/api/java/source/SourceUtils.java --- a/java.source/src/org/netbeans/api/java/source/SourceUtils.java +++ b/java.source/src/org/netbeans/api/java/source/SourceUtils.java @@ -113,7 +113,6 @@ import org.netbeans.modules.java.source.usages.ClassIndexManager; import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor; import org.netbeans.modules.java.source.usages.ExecutableFilesIndex; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.modules.parsing.api.ParserManager; import org.netbeans.modules.parsing.api.ResultIterator; import org.netbeans.modules.parsing.api.UserTask; @@ -126,6 +125,7 @@ import org.openide.filesystems.URLMapper; import org.openide.util.Exceptions; import org.openide.util.Lookup; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.Utilities; @@ -491,19 +491,19 @@ } final List> fos = findAllResources(pkgName, cps); for (Pair pair : fos) { - FileObject root = pair.second.findOwnerRoot(pair.first); + FileObject root = pair.second().findOwnerRoot(pair.first()); if (root == null) continue; FileObject[] sourceRoots = SourceForBinaryQuery.findSourceRoots(root.toURL()).getRoots(); ClassPath sourcePath = ClassPathSupport.createClassPath(sourceRoots); LinkedList folders = new LinkedList(sourcePath.findAllResources(pkgName)); if (pkg) { - return folders.isEmpty() ? pair.first : folders.get(0); + return folders.isEmpty() ? pair.first() : folders.get(0); } else { final boolean caseSensitive = isCaseSensitive (); final String sourceFileName = getSourceFileName (className); final Match matchSet = caseSensitive ? new CaseSensitiveMatch(sourceFileName) : new CaseInsensitiveMatch(sourceFileName); - folders.addFirst(pair.first); + folders.addFirst(pair.first()); for (FileObject folder : folders) { for (FileObject child : folder.getChildren()) { if (matchSet.apply(child)) { diff --git a/java.source/src/org/netbeans/modules/java/source/classpath/SourcePath.java b/java.source/src/org/netbeans/modules/java/source/classpath/SourcePath.java --- a/java.source/src/org/netbeans/modules/java/source/classpath/SourcePath.java +++ b/java.source/src/org/netbeans/modules/java/source/classpath/SourcePath.java @@ -54,10 +54,10 @@ import org.netbeans.modules.java.source.usages.ClassIndexManager; import org.netbeans.modules.java.source.usages.ClassIndexManagerEvent; import org.netbeans.modules.java.source.usages.ClassIndexManagerListener; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.spi.java.classpath.ClassPathImplementation; import org.netbeans.spi.java.classpath.FilteringPathResourceImplementation; import org.netbeans.spi.java.classpath.PathResourceImplementation; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.WeakListeners; @@ -155,9 +155,9 @@ @Override public List apply( @NonNull final Pair> resources) { - final List res = new ArrayList(resources.second.size()); - for (PathResourceImplementation pr : resources.second) { - res.add(new FR(pr,resources.first)); + final List res = new ArrayList(resources.second().size()); + for (PathResourceImplementation pr : resources.second()) { + res.add(new FR(pr,resources.first())); } return res; } @@ -169,8 +169,8 @@ @Override public List apply(Pair> resources) { - final List res = new ArrayList(resources.second.size()); - for (PathResourceImplementation pr : resources.second) { + final List res = new ArrayList(resources.second().size()); + for (PathResourceImplementation pr : resources.second()) { res.add(new FR(pr,true)); } return res; diff --git a/java.source/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java b/java.source/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java --- a/java.source/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java +++ b/java.source/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java @@ -120,6 +120,7 @@ import org.openide.util.Exceptions; import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.TopologicalSortException; import org.openide.util.Utilities; @@ -471,11 +472,11 @@ } } for (Pair relURLPair : sourceRelativeURLPairs) { - final String ext = FileObjects.getExtension(relURLPair.first); - final String withoutExt = FileObjects.stripExtension(relURLPair.first); + final String ext = FileObjects.getExtension(relURLPair.first()); + final String withoutExt = FileObjects.stripExtension(relURLPair.first()); final boolean dieIfNoRefFile = VirtualSourceProviderQuery.hasVirtualSource(ext); if (dieIfNoRefFile) { - file = new File(classFolder, relURLPair.first + '.' + FileObjects.RX); + file = new File(classFolder, relURLPair.first() + '.' + FileObjects.RX); } else { file = new File(classFolder, withoutExt + '.' + FileObjects.RS); } @@ -487,8 +488,8 @@ for (String className : readRSFile(file)) { File f = new File(classFolder, FileObjects.convertPackage2Folder(className) + '.' + FileObjects.SIG); if (!binaryName.equals(className)) { - if (javaContext.getFQNs().remove(className, relURLPair.second)) { - toDelete.add(Pair.of(className, relURLPair.first)); + if (javaContext.getFQNs().remove(className, relURLPair.second())) { + toDelete.add(Pair.of(className, relURLPair.first())); removedTypes.add(ElementHandleAccessor.getInstance().create(ElementKind.OTHER, className)); removedFiles.add(f); fmTx.delete(f); @@ -504,7 +505,7 @@ fmTx.delete(file); } if (cont && (file = new File(classFolder, withoutExt + '.' + FileObjects.SIG)).exists()) { - if (javaContext.getFQNs().remove(FileObjects.getBinaryName(file, classFolder), relURLPair.second)) { + if (javaContext.getFQNs().remove(FileObjects.getBinaryName(file, classFolder), relURLPair.second())) { String fileName = file.getName(); fileName = fileName.substring(0, fileName.lastIndexOf('.')); final String[][] patterns = new String[][]{ diff --git a/java.source/src/org/netbeans/modules/java/source/indexing/JavaParsingContext.java b/java.source/src/org/netbeans/modules/java/source/indexing/JavaParsingContext.java --- a/java.source/src/org/netbeans/modules/java/source/indexing/JavaParsingContext.java +++ b/java.source/src/org/netbeans/modules/java/source/indexing/JavaParsingContext.java @@ -75,12 +75,12 @@ import org.netbeans.modules.java.source.usages.ClassIndexImpl; import org.netbeans.modules.java.source.usages.ClassIndexManager; import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.modules.java.source.usages.SourceAnalyzerFactory; import org.netbeans.modules.parsing.spi.indexing.Context; import org.netbeans.modules.parsing.spi.indexing.Indexable; import org.openide.filesystems.FileObject; import org.openide.util.Lookup; +import org.openide.util.Pair; import org.openide.util.lookup.Lookups; //@NotThreadSafe diff --git a/java.source/src/org/netbeans/modules/java/source/indexing/OnePassCompileWorker.java b/java.source/src/org/netbeans/modules/java/source/indexing/OnePassCompileWorker.java --- a/java.source/src/org/netbeans/modules/java/source/indexing/OnePassCompileWorker.java +++ b/java.source/src/org/netbeans/modules/java/source/indexing/OnePassCompileWorker.java @@ -76,13 +76,13 @@ import org.netbeans.modules.java.source.usages.ClassNamesForFileOraculumImpl; import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor; import org.netbeans.modules.java.source.usages.ExecutableFilesIndex; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.modules.parsing.lucene.support.LowMemoryWatcher; import org.netbeans.modules.parsing.spi.indexing.Context; import org.netbeans.modules.parsing.spi.indexing.Indexable; import org.netbeans.modules.parsing.spi.indexing.SuspendStatus; import org.openide.filesystems.FileUtil; import org.openide.util.Exceptions; +import org.openide.util.Pair; /** * @@ -217,7 +217,7 @@ return null; } Pair unit = units.removeFirst(); - active = unit.second; + active = unit.second(); if (finished.contains(active.indexable)) { continue; } @@ -228,7 +228,7 @@ } Iterable types; s = System.nanoTime(); - types = jt.enterTrees(Collections.singletonList(unit.first)); + types = jt.enterTrees(Collections.singletonList(unit.first())); total += System.nanoTime() - s; if (jfo2units.remove(active.jfo) != null) { final Types ts = Types.instance(jt.getContext()); @@ -242,9 +242,9 @@ if (st.hasTag(TypeTag.CLASS)) { ClassSymbol c = st.tsym.outermostClass(); Pair u = jfo2units.remove(c.sourcefile); - if (u != null && !finished.contains(u.second.indexable) && !u.second.indexable.equals(activeIndexable)) { + if (u != null && !finished.contains(u.second().indexable) && !u.second().indexable.equals(activeIndexable)) { if (dependencies.add(u)) { - scan((JCCompilationUnit)u.first); + scan((JCCompilationUnit)u.first()); } } } @@ -253,7 +253,7 @@ } } ScanNested scanner = new ScanNested(); - scanner.scan((JCCompilationUnit)unit.first); + scanner.scan((JCCompilationUnit)unit.first()); if (!scanner.dependencies.isEmpty()) { units.addFirst(unit); for (Pair pair : scanner.dependencies) { @@ -281,10 +281,10 @@ javaContext.getFQNs().set(types, active.indexable.getURL()); boolean[] main = new boolean[1]; if (javaContext.getCheckSums().checkAndSet(active.indexable.getURL(), types, jt.getElements()) || context.isSupplementaryFilesIndexing()) { - javaContext.analyze(Collections.singleton(unit.first), jt, unit.second, addedTypes, main); + javaContext.analyze(Collections.singleton(unit.first()), jt, unit.second(), addedTypes, main); } else { final Set> aTypes = new HashSet>(); - javaContext.analyze(Collections.singleton(unit.first), jt, unit.second, aTypes, main); + javaContext.analyze(Collections.singleton(unit.first()), jt, unit.second(), aTypes, main); addedTypes.addAll(aTypes); modifiedTypes.addAll(aTypes); } diff --git a/java.source/src/org/netbeans/modules/java/source/parsing/CachingArchiveProvider.java b/java.source/src/org/netbeans/modules/java/source/parsing/CachingArchiveProvider.java --- a/java.source/src/org/netbeans/modules/java/source/parsing/CachingArchiveProvider.java +++ b/java.source/src/org/netbeans/modules/java/source/parsing/CachingArchiveProvider.java @@ -58,11 +58,11 @@ import org.netbeans.api.annotations.common.NonNull; import org.netbeans.api.java.platform.JavaPlatform; import org.netbeans.api.java.platform.JavaPlatformManager; -import org.netbeans.modules.java.source.usages.Pair; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.filesystems.URLMapper; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.Utilities; @@ -197,7 +197,7 @@ } synchronized (this) { final Pair res = mapJarToCtSym(f, root); - return res.second != null; + return res.second() != null; } } @@ -233,8 +233,8 @@ if (f.isFile()) { final Pair resolved = mapJarToCtSym(f, root); return new CachingArchive( - resolved.first, - resolved.second, + resolved.first(), + resolved.second(), cacheFile); } else { diff --git a/java.source/src/org/netbeans/modules/java/source/parsing/CompilationInfoImpl.java b/java.source/src/org/netbeans/modules/java/source/parsing/CompilationInfoImpl.java --- a/java.source/src/org/netbeans/modules/java/source/parsing/CompilationInfoImpl.java +++ b/java.source/src/org/netbeans/modules/java/source/parsing/CompilationInfoImpl.java @@ -74,13 +74,13 @@ import org.netbeans.api.java.source.JavaSource; import org.netbeans.api.lexer.TokenHierarchy; import org.netbeans.modules.java.source.JavaFileFilterQuery; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.modules.parsing.api.Snapshot; import org.openide.cookies.EditorCookie; import org.openide.filesystems.FileObject; import org.openide.loaders.DataObject; import org.openide.loaders.DataObjectNotFoundException; import org.openide.util.Exceptions; +import org.openide.util.Pair; /** * diff --git a/java.source/src/org/netbeans/modules/java/source/parsing/FindMethodRegionsVisitor.java b/java.source/src/org/netbeans/modules/java/source/parsing/FindMethodRegionsVisitor.java --- a/java.source/src/org/netbeans/modules/java/source/parsing/FindMethodRegionsVisitor.java +++ b/java.source/src/org/netbeans/modules/java/source/parsing/FindMethodRegionsVisitor.java @@ -53,8 +53,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import javax.swing.text.BadLocationException; import javax.swing.text.Document; -import org.netbeans.modules.java.source.usages.Pair; -import org.openide.util.Exceptions; +import org.openide.util.Pair; /** * diff --git a/java.source/src/org/netbeans/modules/java/source/parsing/JavacParser.java b/java.source/src/org/netbeans/modules/java/source/parsing/JavacParser.java --- a/java.source/src/org/netbeans/modules/java/source/parsing/JavacParser.java +++ b/java.source/src/org/netbeans/modules/java/source/parsing/JavacParser.java @@ -145,7 +145,6 @@ import org.netbeans.modules.java.source.tasklist.CompilerSettings; import org.netbeans.modules.java.source.usages.ClassIndexImpl; import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.modules.parsing.api.Snapshot; import org.netbeans.modules.parsing.api.Source; import org.netbeans.modules.parsing.api.Task; @@ -163,6 +162,7 @@ import org.openide.modules.SpecificationVersion; import org.openide.util.ChangeSupport; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.WeakListeners; /** @@ -432,8 +432,8 @@ if (supportsReparse) { final Pair _changedMethod = changedMethod.getAndSet(null); if (_changedMethod != null && ciImpl != null) { - LOGGER.log(Level.FINE, "\t:trying partial reparse:\n{0}", _changedMethod.first.getText()); //NOI18N - needsFullReparse = !reparseMethod(ciImpl, snapshot, _changedMethod.second, _changedMethod.first.getText()); + LOGGER.log(Level.FINE, "\t:trying partial reparse:\n{0}", _changedMethod.first().getText()); //NOI18N + needsFullReparse = !reparseMethod(ciImpl, snapshot, _changedMethod.second(), _changedMethod.first().getText()); if (!needsFullReparse) { ciImpl.setChangedMethod(_changedMethod); } @@ -1243,7 +1243,7 @@ int end = evt.affectedEndOffset(); synchronized (positions) { for (Pair pe : positions) { - PositionRegion p = pe.first; + PositionRegion p = pe.first(); if (start > p.getStartOffset() && end < p.getEndOffset()) { changedMethod = pe; break; diff --git a/java.source/src/org/netbeans/modules/java/source/parsing/ProcessorGenerated.java b/java.source/src/org/netbeans/modules/java/source/parsing/ProcessorGenerated.java --- a/java.source/src/org/netbeans/modules/java/source/parsing/ProcessorGenerated.java +++ b/java.source/src/org/netbeans/modules/java/source/parsing/ProcessorGenerated.java @@ -68,8 +68,8 @@ import org.netbeans.modules.java.source.classpath.AptCacheForSourceQuery; import org.netbeans.modules.java.source.indexing.JavaIndex; import org.netbeans.modules.java.source.indexing.TransactionContext; -import org.netbeans.modules.java.source.usages.Pair; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.Utilities; @@ -107,7 +107,7 @@ public Set getGeneratedSources(final URL forSource) { Pair,Set> res = generated.get(forSource); - return res == null ? null : res.first; + return res == null ? null : res.first(); } public boolean canWrite() { @@ -173,10 +173,10 @@ } switch (type) { case SOURCE: - insertInto.first.add(file); + insertInto.first().add(file); break; case RESOURCE: - insertInto.second.add(file); + insertInto.second().add(file); break; default: throw new IllegalArgumentException(); @@ -196,8 +196,8 @@ for (Map.Entry,Set>> entry : generated.entrySet()) { final URL source = entry.getKey(); final Pair,Set> gen = entry.getValue(); - final Set genSources = gen.first; - final Set genResources = gen.second; + final Set genSources = gen.first(); + final Set genResources = gen.second(); commitSource(source, genSources, genResources); } writeResources(); diff --git a/java.source/src/org/netbeans/modules/java/source/parsing/SiblingSupport.java b/java.source/src/org/netbeans/modules/java/source/parsing/SiblingSupport.java --- a/java.source/src/org/netbeans/modules/java/source/parsing/SiblingSupport.java +++ b/java.source/src/org/netbeans/modules/java/source/parsing/SiblingSupport.java @@ -47,7 +47,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.netbeans.api.annotations.common.NonNull; -import org.netbeans.modules.java.source.usages.Pair; +import org.openide.util.Pair; /** * @@ -81,7 +81,7 @@ } else { LOG.log(Level.FINE, "Poped sibling: {0} size: {1}", new Object[] {removed, siblings.size()}); //NOI18N } - return removed.first; + return removed.first(); } @Override @@ -104,10 +104,10 @@ Level.FINER, "Returns sibling: {0} in source root? {1}", //NOI18N new Object[] { - result.first, - result.second + result.first(), + result.second() }); - return result.first; + return result.first(); } @Override @@ -119,7 +119,7 @@ @Override public boolean isInSourceRoot() { - return siblings.peek().second; + return siblings.peek().second(); } } diff --git a/java.source/src/org/netbeans/modules/java/source/parsing/WriteBackTransaction.java b/java.source/src/org/netbeans/modules/java/source/parsing/WriteBackTransaction.java --- a/java.source/src/org/netbeans/modules/java/source/parsing/WriteBackTransaction.java +++ b/java.source/src/org/netbeans/modules/java/source/parsing/WriteBackTransaction.java @@ -68,8 +68,8 @@ import org.netbeans.api.annotations.common.NonNull; import org.netbeans.api.annotations.common.NullAllowed; import org.netbeans.modules.java.preprocessorbridge.spi.JavaFileFilterImplementation; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.modules.java.source.util.Iterators; +import org.openide.util.Pair; import org.openide.util.Utilities; /** @@ -270,11 +270,11 @@ @NonNull final Location location, final boolean readOnly) { if (location == StandardLocation.CLASS_OUTPUT) { - return contentCache.first; + return contentCache.first(); } else if (location == StandardLocation.SOURCE_OUTPUT) { - return contentCache.second; + return contentCache.second(); } else if (readOnly && location == StandardLocation.CLASS_PATH) { - return contentCache.first; + return contentCache.first(); } else { throw new IllegalArgumentException("Unsupported Location: " + location); //NOI18N } @@ -298,8 +298,8 @@ private void flushFiles(boolean inCommit) throws IOException { LOG.log(Level.FINE, "Flushing:{0}", getRootDir()); - doFlushFiles(contentCache.first, inCommit); - doFlushFiles(contentCache.second, inCommit); + doFlushFiles(contentCache.first(), inCommit); + doFlushFiles(contentCache.second(), inCommit); } private void doFlushFiles( @@ -326,8 +326,8 @@ FileObjects.deleteRecursively(d); } deleted.clear(); - contentCache.first.clear(); - contentCache.second.clear(); + contentCache.first().clear(); + contentCache.second().clear(); } @Override @@ -426,7 +426,7 @@ (FileObjects.FileBase)FileObjects.fileFileObject(shadowFile, getRootFile(shadowFile, getPackage()), filter, encoding), Boolean.TRUE); } - return delegate.first; + return delegate.first(); } public File getCurrentFile() { @@ -442,7 +442,7 @@ if (wasFlushed()) { return; } - if (delegate != null && delegate.second == Boolean.FALSE) { + if (delegate != null && delegate.second() == Boolean.FALSE) { if (inCommit) { shadowFile = this.f; release(); @@ -510,8 +510,8 @@ @Override public boolean delete() { - if (delegate != null && delegate.second == Boolean.TRUE) { - return delegate.first.delete(); + if (delegate != null && delegate.second() == Boolean.TRUE) { + return delegate.first().delete(); } else { if (writer != null) { writer.delete(toFile(this)); @@ -523,7 +523,7 @@ @Override public InputStream openInputStream() throws IOException { if (delegate != null) { - return delegate.first.openInputStream(); + return delegate.first().openInputStream(); } else { return new ByteArrayInputStream(content); } @@ -533,7 +533,7 @@ public OutputStream openOutputStream() throws IOException { modify(); if (delegate != null) { - return delegate.first.openOutputStream(); + return delegate.first().openOutputStream(); } else { return new ByteArrayOutputStream() { boolean closed; @@ -554,7 +554,7 @@ } private void modify() { - if (delegate != null && delegate.second == Boolean.FALSE) { + if (delegate != null && delegate.second() == Boolean.FALSE) { delegate = null; } } diff --git a/java.source/src/org/netbeans/modules/java/source/save/PositionEstimator.java b/java.source/src/org/netbeans/modules/java/source/save/PositionEstimator.java --- a/java.source/src/org/netbeans/modules/java/source/save/PositionEstimator.java +++ b/java.source/src/org/netbeans/modules/java/source/save/PositionEstimator.java @@ -62,11 +62,11 @@ import org.netbeans.api.editor.guards.GuardedSectionManager; import org.netbeans.api.java.lexer.JavaTokenId; import org.netbeans.modules.java.source.transform.FieldGroupTree; -import org.netbeans.modules.java.source.usages.Pair; import static org.netbeans.api.java.lexer.JavaTokenId.*; import org.netbeans.api.lexer.Token; import org.netbeans.api.lexer.TokenSequence; import org.netbeans.modules.java.source.save.CasualDiff.LineInsertionType; +import org.openide.util.Pair; /** * Estimates the position for given element or element set. Offsets are @@ -997,7 +997,7 @@ if (commentEndPos.isEmpty()) { wideEnd = seq.offset() + indexOf + 1; } else { - commentEndPos.add(Pair.of(commentEndPos.getLast().first, seq.offset() + indexOf + 1)); + commentEndPos.add(Pair.of(commentEndPos.getLast().first(), seq.offset() + indexOf + 1)); } } } @@ -1031,8 +1031,8 @@ } maxLines = Math.max(maxLines, newlines); for (Pair comment : commentEndPos) { - if (comment.first < maxLines || comment.first == 0) { - wideEnd = comment.second; + if (comment.first() < maxLines || comment.first() == 0) { + wideEnd = comment.second(); } else { break; } diff --git a/java.source/src/org/netbeans/modules/java/source/save/Reformatter.java b/java.source/src/org/netbeans/modules/java/source/save/Reformatter.java --- a/java.source/src/org/netbeans/modules/java/source/save/Reformatter.java +++ b/java.source/src/org/netbeans/modules/java/source/save/Reformatter.java @@ -66,7 +66,6 @@ import org.netbeans.modules.java.source.JavaSourceAccessor; import org.netbeans.modules.java.source.parsing.FileObjects; import org.netbeans.modules.java.source.parsing.JavacParser; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.modules.parsing.api.Embedding; import org.netbeans.modules.parsing.api.ParserManager; import org.netbeans.modules.parsing.api.ResultIterator; @@ -76,6 +75,7 @@ import org.netbeans.modules.parsing.spi.ParseException; import org.netbeans.modules.parsing.spi.Parser; import org.netbeans.spi.java.classpath.support.ClassPathSupport; +import org.openide.util.Pair; /** * @@ -3867,7 +3867,7 @@ tokenText = javadocTokens.token().text().toString(); if (tokenText.endsWith(">")) { //NOI18N if (P_TAG.equalsIgnoreCase(tokenText)) { - if (currWSOffset >= 0 && (toAdd == null || toAdd.first < currWSOffset)) { + if (currWSOffset >= 0 && (toAdd == null || toAdd.first() < currWSOffset)) { marks.add(Pair.of(currWSOffset, 1)); } lastAddedNLOffset = javadocTokens.offset() + javadocTokens.token().length() - offset; @@ -3875,7 +3875,7 @@ afterText = false; } else if (PRE_TAG.equalsIgnoreCase(tokenText) || CODE_TAG.equalsIgnoreCase(tokenText)) { - if (currWSOffset >= 0 && state == 0 && (toAdd == null || toAdd.first < currWSOffset)) { + if (currWSOffset >= 0 && state == 0 && (toAdd == null || toAdd.first() < currWSOffset)) { marks.add(Pair.of(currWSOffset, 1)); } marks.add(Pair.of(javadocTokens.offset() - offset, 5)); @@ -3884,7 +3884,7 @@ marks.add(Pair.of(currWSOffset >= 0 ? currWSOffset : javadocTokens.offset() - offset, 6)); } else { if (currWSOffset >= 0 && lastNLOffset >= currWSOffset - && lastAddedNLOffset < currWSOffset && (toAdd == null || toAdd.first < currWSOffset)) { + && lastAddedNLOffset < currWSOffset && (toAdd == null || toAdd.first() < currWSOffset)) { marks.add(Pair.of(currWSOffset, 1)); } nlAdd = Pair.of(javadocTokens.offset() + javadocTokens.token().length() - offset, 1); @@ -4001,8 +4001,8 @@ Iterator> it = marks.iterator(); if (it.hasNext()) { Pair next = it.next(); - checkOffset = next.first; - actionType = next.second; + checkOffset = next.first(); + actionType = next.second(); } else { checkOffset = Integer.MAX_VALUE; actionType = -1; @@ -4089,8 +4089,8 @@ align = -1; if (it.hasNext()) { Pair next = it.next(); - checkOffset = next.first; - actionType = next.second; + checkOffset = next.first(); + actionType = next.second(); } else { checkOffset = Integer.MAX_VALUE; actionType = -1; @@ -4162,8 +4162,8 @@ } if (it.hasNext()) { Pair next = it.next(); - checkOffset = next.first; - actionType = next.second; + checkOffset = next.first(); + actionType = next.second(); } else { checkOffset = Integer.MAX_VALUE; actionType = -1; diff --git a/java.source/src/org/netbeans/modules/java/source/usages/BinaryAnalyser.java b/java.source/src/org/netbeans/modules/java/source/usages/BinaryAnalyser.java --- a/java.source/src/org/netbeans/modules/java/source/usages/BinaryAnalyser.java +++ b/java.source/src/org/netbeans/modules/java/source/usages/BinaryAnalyser.java @@ -114,6 +114,7 @@ import org.openide.filesystems.FileUtil; import org.openide.filesystems.URLMapper; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.Utilities; @@ -330,9 +331,9 @@ final PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file),"UTF-8")); //NOI18N try { for (Pair,Long> pair : state) { - StringBuilder sb = new StringBuilder(pair.first.getBinaryName()); + StringBuilder sb = new StringBuilder(pair.first().getBinaryName()); sb.append('='); //NOI18N - sb.append(pair.second.longValue()); + sb.append(pair.second().longValue()); out.println(sb.toString()); } } finally { @@ -375,11 +376,11 @@ if (timeStamps == null) { f.delete(); } else { - timeStamps.first.keySet().removeAll(timeStamps.second); + timeStamps.first().keySet().removeAll(timeStamps.second()); final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f), "UTF-8")); //NOI18N try { // write data - for(LongHashMap.Entry entry : timeStamps.first.entrySet()) { + for(LongHashMap.Entry entry : timeStamps.first().entrySet()) { out.write(entry.getKey()); out.write('='); //NOI18N out.write(Long.toString(entry.getValue())); @@ -394,13 +395,13 @@ } private boolean timeStampsEmpty() { - return timeStamps == null || timeStamps.second.isEmpty(); + return timeStamps == null || timeStamps.second().isEmpty(); } private boolean isUpToDate(final String resourceName, final long timeStamp) throws IOException { final Pair,Set> ts = getTimeStamps(); - long oldTime = ts.first.put(resourceName,timeStamp); - ts.second.remove(resourceName); + long oldTime = ts.first().put(resourceName,timeStamp); + ts.second().remove(resourceName); return oldTime == timeStamp; } @@ -424,33 +425,33 @@ if (newE == null) { newE = newIt.next(); } - int ni = oldE.first.getBinaryName().compareTo(newE.first.getBinaryName()); + int ni = oldE.first().getBinaryName().compareTo(newE.first().getBinaryName()); if (ni == 0) { - if (oldE.second.longValue() == 0 || oldE.second.longValue() != newE.second.longValue()) { - changed.add(oldE.first); + if (oldE.second().longValue() == 0 || oldE.second().longValue() != newE.second().longValue()) { + changed.add(oldE.first()); } oldE = newE = null; } else if (ni < 0) { - removed.add(oldE.first); + removed.add(oldE.first()); oldE = null; } else if (ni > 0) { - added.add(newE.first); + added.add(newE.first()); newE = null; } } if (oldE != null) { - removed.add(oldE.first); + removed.add(oldE.first()); } while (oldIt.hasNext()) { - removed.add(oldIt.next().first); + removed.add(oldIt.next().first()); } if (newE != null) { - added.add(newE.first); + added.add(newE.first()); } while (newIt.hasNext()) { - added.add(newIt.next().first); + added.add(newIt.next().first()); } return new Changes(true, added, removed, changed, preBuildArgs); } @@ -859,7 +860,7 @@ public int compare( final Pair,Long> o1, final Pair,Long> o2) { - return o1.first.getBinaryName().compareTo(o2.first.getBinaryName()); + return o1.first().getBinaryName().compareTo(o2.first().getBinaryName()); } }; @@ -1077,7 +1078,7 @@ return false; } } - for (String deleted : getTimeStamps().second) { + for (String deleted : getTimeStamps().second()) { delete(deleted); markChanged(); } @@ -1137,7 +1138,7 @@ DeletedRootProcessor(@NonNull final Context ctx) throws IOException { super(ctx); final Pair, Set> ts = getTimeStamps(); - if (!ts.first.isEmpty()) { + if (!ts.first().isEmpty()) { markChanged(); } } diff --git a/java.source/src/org/netbeans/modules/java/source/usages/ClassIndexImpl.java b/java.source/src/org/netbeans/modules/java/source/usages/ClassIndexImpl.java --- a/java.source/src/org/netbeans/modules/java/source/usages/ClassIndexImpl.java +++ b/java.source/src/org/netbeans/modules/java/source/usages/ClassIndexImpl.java @@ -67,6 +67,7 @@ import org.netbeans.modules.parsing.lucene.support.Convertor; import org.openide.filesystems.FileObject; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.Utilities; /** Should probably final class with private constructor. diff --git a/java.source/src/org/netbeans/modules/java/source/usages/ClassIndexManager.java b/java.source/src/org/netbeans/modules/java/source/usages/ClassIndexManager.java --- a/java.source/src/org/netbeans/modules/java/source/usages/ClassIndexManager.java +++ b/java.source/src/org/netbeans/modules/java/source/usages/ClassIndexManager.java @@ -61,6 +61,7 @@ import org.netbeans.modules.java.source.indexing.TransactionContext; import org.openide.filesystems.FileUtil; import org.openide.util.Exceptions; +import org.openide.util.Pair; /** * @@ -106,14 +107,14 @@ return; } Pair pair = getClassIndex(root, beforeCreateAllowed, false); - index[0] = pair.first; + index[0] = pair.first(); if (index[0] != null) { return; } URL translatedRoot = AptCacheForSourceQuery.getSourceFolder(root); if (translatedRoot != null) { pair = getClassIndex(translatedRoot, beforeCreateAllowed, false); - index[0] = pair.first; + index[0] = pair.first(); if (index[0] != null) { return; } @@ -170,7 +171,7 @@ return null; } Pair pair = getClassIndex (root, true, true); - ClassIndexImpl qi = pair.first; + ClassIndexImpl qi = pair.first(); if (qi == null) { qi = getUsagesQuery(root, true); if (qi == null) { @@ -194,7 +195,7 @@ this.instances.put(root,qi); this.transientInstances.remove(root); markAddedRoot(root); - } else if (pair.second) { + } else if (pair.second()) { markAddedRoot(root); } return qi; diff --git a/java.source/src/org/netbeans/modules/java/source/usages/DocumentUtil.java b/java.source/src/org/netbeans/modules/java/source/usages/DocumentUtil.java --- a/java.source/src/org/netbeans/modules/java/source/usages/DocumentUtil.java +++ b/java.source/src/org/netbeans/modules/java/source/usages/DocumentUtil.java @@ -77,6 +77,7 @@ import org.netbeans.modules.parsing.lucene.support.Queries; import org.openide.filesystems.FileObject; import org.openide.util.Exceptions; +import org.openide.util.Pair; /** * @@ -529,10 +530,10 @@ private static class DocumentConvertor implements Convertor,Object[]>,Document> { @Override public Document convert(Pair, Object[]> entry) { - final Pair pair = entry.first; - final String cn = pair.first; - final String srcName = pair.second; - final Object[] data = entry.second; + final Pair pair = entry.first(); + final String cn = pair.first(); + final String srcName = pair.second(); + final Object[] data = entry.second(); final List cr = (List) data[0]; final String fids = (String) data[1]; final String ids = (String) data[2]; @@ -550,8 +551,8 @@ @Override public Query convert(Pair p) { - final String resourceName = p.first; - final String sourceName = p.second; + final String resourceName = p.first(); + final String sourceName = p.second(); return fileBased ? createClassesInFileQuery(resourceName,sourceName) : createClassWithEnclosedQuery(resourceName, sourceName); } @@ -613,8 +614,8 @@ private static Query binaryNameSourceNamePairQuery (final Pair binaryNameSourceNamePair) { assert binaryNameSourceNamePair != null; - final String binaryName = binaryNameSourceNamePair.first; - final String sourceName = binaryNameSourceNamePair.second; + final String binaryName = binaryNameSourceNamePair.first(); + final String sourceName = binaryNameSourceNamePair.second(); final Query query = binaryNameQuery(binaryName); if (sourceName != null) { assert query instanceof BooleanQuery : "The DocumentUtil.binaryNameQuery was incompatibly changed!"; //NOI18N diff --git a/java.source/src/org/netbeans/modules/java/source/usages/Pair.java b/java.source/src/org/netbeans/modules/java/source/usages/Pair.java deleted file mode 100644 --- a/java.source/src/org/netbeans/modules/java/source/usages/Pair.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * Contributor(s): - * - * Portions Copyrighted 2007 Sun Microsystems, Inc. - */ -package org.netbeans.modules.java.source.usages; - -/** - * - * @author Tomas Zezula - */ -public final class Pair { - - public final P first; - public final K second; - - private Pair (P first, K second) { - this.first = first; - this.second = second; - } - - - public static Pair of (P first, K second) { - return new Pair (first,second); - } - - - @Override - public int hashCode () { - int hashCode = 0; - hashCode ^= first == null ? 0 : first.hashCode(); - hashCode ^= second == null ? 0: second.hashCode(); - return hashCode; - } - - @Override - public boolean equals (final Object other) { - if (other instanceof Pair) { - Pair otherPair = (Pair) other; - return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) && - (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second)); - } - return false; - } - - @Override - public String toString () { - return String.format("Pair[%s,%s]", first,second); - } -} diff --git a/java.source/src/org/netbeans/modules/java/source/usages/PersistentClassIndex.java b/java.source/src/org/netbeans/modules/java/source/usages/PersistentClassIndex.java --- a/java.source/src/org/netbeans/modules/java/source/usages/PersistentClassIndex.java +++ b/java.source/src/org/netbeans/modules/java/source/usages/PersistentClassIndex.java @@ -79,6 +79,7 @@ import org.openide.filesystems.FileUtil; import org.openide.filesystems.URLMapper; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.Parameters; /** @@ -213,9 +214,9 @@ QueryUtil.createPackageUsagesQuery(binaryName,usageType,Occur.SHOULD), scope); if (q!=null) { - index.query(result, ctu.first, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), q); - if (ctu.second != null) { - ctu.second.query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), q); + index.query(result, ctu.first(), DocumentUtil.declaredTypesFieldSelector(), cancel.get(), q); + if (ctu.second() != null) { + ctu.second().query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), q); } } return null; @@ -239,9 +240,9 @@ QueryUtil.createUsagesQuery(binaryName, usageType, Occur.SHOULD), scope); if (usagesQuery != null) { - index.query(result, ctu.first, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), usagesQuery); - if (ctu.second != null) { - ctu.second.query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), usagesQuery); + index.query(result, ctu.first(), DocumentUtil.declaredTypesFieldSelector(), cancel.get(), usagesQuery); + if (ctu.second() != null) { + ctu.second().query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), usagesQuery); } } return null; @@ -277,9 +278,9 @@ DocumentUtil.translateQueryKind(kind)), scope); if (query != null) { - index.query(result, ctu.first, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query); - if (ctu.second != null) { - ctu.second.query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query); + index.query(result, ctu.first(), DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query); + if (ctu.second() != null) { + ctu.second().query(result, convertor, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query); } } return null; @@ -315,13 +316,13 @@ }; index.queryDocTerms( result, - ctu.first, + ctu.first(), t2s, DocumentUtil.declaredTypesFieldSelector(), cancel.get(), query); - if (ctu.second != null) { - ctu.second.queryDocTerms( + if (ctu.second() != null) { + ctu.second().queryDocTerms( result, convertor, t2s, @@ -360,7 +361,7 @@ collectInto = result; } final Pair,Term> filter = QueryUtil.createPackageFilter(prefix,directOnly); - index.queryTerms(collectInto, filter.second, filter.first, cancel.get()); + index.queryTerms(collectInto, filter.second(), filter.first(), cancel.get()); if (cacheOp) { synchronized (PersistentClassIndex.this) { if (rootPkgCache == null) { @@ -543,8 +544,8 @@ final Pair> data = updateDirty(); if (data != null) { return Pair.,Index>of( - new FilterConvertor(data.second, delegate), - data.first); + new FilterConvertor(data.second(), delegate), + data.first()); } } catch (IOException ioe) { Exceptions.printStackTrace(ioe); diff --git a/java.source/src/org/netbeans/modules/java/source/usages/QueryUtil.java b/java.source/src/org/netbeans/modules/java/source/usages/QueryUtil.java --- a/java.source/src/org/netbeans/modules/java/source/usages/QueryUtil.java +++ b/java.source/src/org/netbeans/modules/java/source/usages/QueryUtil.java @@ -59,6 +59,7 @@ import org.netbeans.modules.java.source.usages.ClassIndexImpl.UsageType; import org.netbeans.modules.parsing.lucene.support.Queries; import org.netbeans.modules.parsing.lucene.support.StoppableConvertor; +import org.openide.util.Pair; import org.openide.util.Parameters; /** diff --git a/java.source/src/org/netbeans/modules/java/source/usages/SourceAnalyzerFactory.java b/java.source/src/org/netbeans/modules/java/source/usages/SourceAnalyzerFactory.java --- a/java.source/src/org/netbeans/modules/java/source/usages/SourceAnalyzerFactory.java +++ b/java.source/src/org/netbeans/modules/java/source/usages/SourceAnalyzerFactory.java @@ -85,6 +85,7 @@ import org.openide.filesystems.FileUtil; import org.openide.filesystems.URLMapper; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.Parameters; /** @@ -443,7 +444,7 @@ final String classNameType = className + DocumentUtil.encodeKind(ElementKind.CLASS); final Pair name = Pair.of(classNameType, null); for (Pair usage : packageAnnotations) { - addUsage(usage.first, name, p, usage.second); + addUsage(usage.first(), name, p, usage.second()); } for (CharSequence ident : packageAnnotationIdents) { addIdent(name, ident, p, false); @@ -641,7 +642,7 @@ crossedTopLevel = true; } } else { - resourceName = activeClass.peek().second; + resourceName = activeClass.peek().second(); } name = Pair.of(classNameType, resourceName); nameFrom = 2; @@ -663,7 +664,7 @@ if (className != null) { if (topLevel) { if (topLevels != null) { - topLevels.add (Pair.of(className, name.second)); + topLevels.add (Pair.of(className, name.second())); } try { addAndClearImports(name, p); @@ -937,8 +938,8 @@ private UsagesData getData (@NonNull final Pairowner, @NonNull final Map, UsagesData> map) { UsagesData data = map.get(owner); if (data == null) { - if (owner.first.charAt(owner.first.length()-2) == '.') { //NOI18N - throw new IllegalArgumentException(owner.first); + if (owner.first().charAt(owner.first().length()-2) == '.') { //NOI18N + throw new IllegalArgumentException(owner.first()); } data = new UsagesData (CONVERTOR); map.put(owner,data); diff --git a/java.source/src/org/netbeans/modules/java/source/usages/VirtualSourceProviderQuery.java b/java.source/src/org/netbeans/modules/java/source/usages/VirtualSourceProviderQuery.java --- a/java.source/src/org/netbeans/modules/java/source/usages/VirtualSourceProviderQuery.java +++ b/java.source/src/org/netbeans/modules/java/source/usages/VirtualSourceProviderQuery.java @@ -62,6 +62,7 @@ import org.openide.util.Lookup; import org.openide.util.LookupEvent; import org.openide.util.LookupListener; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.Utilities; import org.openide.util.WeakListeners; @@ -131,7 +132,7 @@ m.put(ext, Pair.of(prov, l)); } else { - l = p.second; + l = p.second(); } try { final File file = Utilities.toFile(indexable.getURL().toURI()); @@ -147,8 +148,8 @@ final R r = new R (root, file2indexables); for (Pair> p : m.values()) { - final VirtualSourceProvider prov = p.first; - final List tf = p.second; + final VirtualSourceProvider prov = p.first(); + final List tf = p.second(); r.setProvider(prov); prov.translate(tf, root,r); } diff --git a/java.source/test/unit/src/org/netbeans/api/java/source/JavaSourceTest.java b/java.source/test/unit/src/org/netbeans/api/java/source/JavaSourceTest.java --- a/java.source/test/unit/src/org/netbeans/api/java/source/JavaSourceTest.java +++ b/java.source/test/unit/src/org/netbeans/api/java/source/JavaSourceTest.java @@ -106,7 +106,6 @@ import org.netbeans.modules.java.source.parsing.DocPositionRegion; import org.netbeans.modules.java.source.parsing.JavaFileObjectProvider; import org.netbeans.modules.java.source.parsing.SourceFileObject; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.modules.parsing.lucene.IndexFactory; import org.netbeans.modules.parsing.lucene.support.Convertor; import org.netbeans.modules.parsing.lucene.support.Index; @@ -140,6 +139,7 @@ import org.netbeans.modules.parsing.spi.TaskIndexingMode; import org.netbeans.spi.java.classpath.ClassPathProvider; import org.openide.util.Exceptions; +import org.openide.util.Pair; /** * * @author Tomas Zezula diff --git a/java.source/test/unit/src/org/netbeans/api/java/source/support/ProfileSupportTest.java b/java.source/test/unit/src/org/netbeans/api/java/source/support/ProfileSupportTest.java --- a/java.source/test/unit/src/org/netbeans/api/java/source/support/ProfileSupportTest.java +++ b/java.source/test/unit/src/org/netbeans/api/java/source/support/ProfileSupportTest.java @@ -78,11 +78,11 @@ import org.netbeans.modules.java.platform.JavaPlatformProvider; import org.netbeans.modules.java.source.ElementHandleAccessor; import org.netbeans.modules.java.source.parsing.FileObjects; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.spi.java.classpath.support.ClassPathSupport; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.modules.SpecificationVersion; +import org.openide.util.Pair; import org.openide.util.Utilities; /** @@ -214,7 +214,7 @@ public int compare( Pair, SourceLevelQuery.Profile> o1, Pair, SourceLevelQuery.Profile> o2) { - return o1.first.getBinaryName().compareTo(o2.first.getBinaryName()); + return o1.first().getBinaryName().compareTo(o2.first().getBinaryName()); } }); } @@ -352,8 +352,8 @@ JP(Pair p) { - this.home = FileUtil.toFileObject(p.first); - this.boot = ClassPathSupport.createClassPath(p.second); + this.home = FileUtil.toFileObject(p.first()); + this.boot = ClassPathSupport.createClassPath(p.second()); } diff --git a/java.source/test/unit/src/org/netbeans/modules/java/source/parsing/CachingFileManagerTest.java b/java.source/test/unit/src/org/netbeans/modules/java/source/parsing/CachingFileManagerTest.java --- a/java.source/test/unit/src/org/netbeans/modules/java/source/parsing/CachingFileManagerTest.java +++ b/java.source/test/unit/src/org/netbeans/modules/java/source/parsing/CachingFileManagerTest.java @@ -58,9 +58,9 @@ import javax.tools.StandardLocation; import org.netbeans.api.java.classpath.ClassPath; import org.netbeans.junit.NbTestCase; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.spi.java.classpath.support.ClassPathSupport; import org.openide.filesystems.FileUtil; +import org.openide.util.Pair; import org.openide.util.Utilities; /** @@ -120,20 +120,20 @@ final CachingArchiveProvider provider = CachingArchiveProvider.getDefault(); final CachingFileManager manager = new CachingFileManager(provider, cp, false, true); for (Pair,URI> testCase : testCases) { - final Pair name = testCase.first; - final URI expectedURI = testCase.second; - FileObject fo = manager.getFileForInput(StandardLocation.CLASS_PATH, name.first, name.second); + final Pair name = testCase.first(); + final URI expectedURI = testCase.second(); + FileObject fo = manager.getFileForInput(StandardLocation.CLASS_PATH, name.first(), name.second()); if (expectedURI == null) { assertNull( String.format("Lookup: %s/%s expected: null", - name.first, - name.second), + name.first(), + name.second()), fo); } else { assertEquals( String.format("Lookup: %s/%s expected: %s", - name.first, - name.second, + name.first(), + name.second(), expectedURI), expectedURI, fo.toUri()); diff --git a/java.source/test/unit/src/org/netbeans/modules/java/source/usages/BinaryAnalyserTest.java b/java.source/test/unit/src/org/netbeans/modules/java/source/usages/BinaryAnalyserTest.java --- a/java.source/test/unit/src/org/netbeans/modules/java/source/usages/BinaryAnalyserTest.java +++ b/java.source/test/unit/src/org/netbeans/modules/java/source/usages/BinaryAnalyserTest.java @@ -76,6 +76,7 @@ import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.Utilities; /** diff --git a/java.source/test/unit/src/org/netbeans/modules/java/source/usages/LucenePerformanceTest.java b/java.source/test/unit/src/org/netbeans/modules/java/source/usages/LucenePerformanceTest.java --- a/java.source/test/unit/src/org/netbeans/modules/java/source/usages/LucenePerformanceTest.java +++ b/java.source/test/unit/src/org/netbeans/modules/java/source/usages/LucenePerformanceTest.java @@ -71,6 +71,7 @@ import org.netbeans.modules.parsing.lucene.support.IndexManagerTestUtilities; import org.netbeans.modules.parsing.lucene.support.Queries; import org.netbeans.modules.parsing.lucene.support.StoppableConvertor; +import org.openide.util.Pair; /** * @@ -115,7 +116,7 @@ Set result = new HashSet(); startTime = System.currentTimeMillis(); final Pair,Term> filter = QueryUtil.createPackageFilter("", true); - index.queryTerms(result, filter.second, filter.first, null); + index.queryTerms(result, filter.second(), filter.first(), null); endTime = System.currentTimeMillis(); delta = (endTime-startTime); System.out.println("Packages: " + delta); diff --git a/java.sourceui/nbproject/project.xml b/java.sourceui/nbproject/project.xml --- a/java.sourceui/nbproject/project.xml +++ b/java.sourceui/nbproject/project.xml @@ -216,7 +216,7 @@ - 8.0 + 8.32 diff --git a/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java b/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java --- a/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java +++ b/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java @@ -79,13 +79,13 @@ import org.netbeans.modules.java.preprocessorbridge.api.JavaSourceUtil; import org.netbeans.modules.java.source.JavadocHelper; import org.netbeans.modules.java.source.parsing.FileObjects; -import org.netbeans.modules.java.source.usages.Pair; import org.netbeans.spi.java.classpath.support.ClassPathSupport; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileStateInvalidException; import org.openide.filesystems.FileUtil; import org.openide.util.Exceptions; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.RequestProcessor; import org.openide.xml.XMLUtil; @@ -344,7 +344,7 @@ this.cpInfo = compilationInfo.getClasspathInfo(); this.handle = element == null ? null : ElementHandle.create(element); this.cancel = cancel; - Doc doc = context.second.javaDocFor(element); + Doc doc = context.second().javaDocFor(element); boolean localized = false; StringBuilder content = new StringBuilder(); JavadocHelper.TextStream page = null; @@ -397,7 +397,7 @@ c.toPhase(Phase.RESOLVED); final Element element = handle.resolve(c); Pair context = Pair.of(c.getTrees(), c.getElementUtilities()); - Doc doc = context.second.javaDocFor(element); + Doc doc = context.second().javaDocFor(element); JavadocHelper.TextStream page = JavadocHelper.getJavadoc(element, cancel); return prepareContent(contentFin, doc,localizedFin, page, cancel, false, context).get(); } @@ -787,7 +787,7 @@ StringBuilder sb = new StringBuilder(); ClassDoc cls = peDoc.containingClass(); if (cls != null) { - Element e = ctx.second.elementFor(cls); + Element e = ctx.second().elementFor(cls); if (e != null) { switch(e.getEnclosingElement().getKind()) { case ANNOTATION_TYPE: @@ -806,7 +806,7 @@ PackageDoc pkg = peDoc.containingPackage(); if (pkg != null) { sb.append(""); //NOI18N - createLink(sb, ctx.second.elementFor(pkg), makeNameLineBreakable(pkg.name())); + createLink(sb, ctx.second().elementFor(pkg), makeNameLineBreakable(pkg.name())); sb.append(""); //NOI18N) } } @@ -973,7 +973,7 @@ sb.append('('); //NOI18N for (int i = 0; i < pairs.length; i++) { AnnotationTypeElementDoc ated = pairs[i].element(); - createLink(sb, ctx.second.elementFor(ated), ated.name()); + createLink(sb, ctx.second().elementFor(ated), ated.name()); sb.append('='); //NOI18N appendAnnotationValue(sb, pairs[i].value(), ctx); if (i < pairs.length - 1) @@ -1009,7 +1009,7 @@ if (length > 1) sb.append('}'); //NOI18N } else if (value instanceof Doc) { - createLink(sb, ctx.second.elementFor((Doc)value), ((Doc)value).name()); + createLink(sb, ctx.second().elementFor((Doc)value), ((Doc)value).name()); } else { sb.append(value.toString()); } @@ -1061,7 +1061,7 @@ thr.append(""); //NOI18N Type exType = throwsTag.exceptionType(); if (exType != null) { - createLink(thr, ctx.second.elementFor(exType.asClassDoc()), exType.simpleTypeName()); + createLink(thr, ctx.second().elementFor(exType.asClassDoc()), exType.simpleTypeName()); } else { thr.append(throwsTag.exceptionName()); } @@ -1090,7 +1090,7 @@ String label = stag.label(); if (memberName != null) { if (refClass != null) { - createLink(see, ctx.second.elementFor(stag.referencedMember()), "" + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + ""); //NOI18N + createLink(see, ctx.second().elementFor(stag.referencedMember()), "" + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + ""); //NOI18N } else { see.append(className); see.append('.'); //NOI18N @@ -1099,9 +1099,9 @@ see.append(", "); //NOI18N } else if (className != null) { if (refClass != null) { - createLink(see, ctx.second.elementFor(refClass), "" + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + ""); //NOI18N + createLink(see, ctx.second().elementFor(refClass), "" + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + ""); //NOI18N } else if (refPackage != null) { - createLink(see, ctx.second.elementFor(refPackage), "" + (label != null && label.length() > 0 ? label : refPackage.name()) + ""); //NOI18N + createLink(see, ctx.second().elementFor(refPackage), "" + (label != null && label.length() > 0 ? label : refPackage.name()) + ""); //NOI18N } else { see.append(className); } @@ -1159,7 +1159,7 @@ thr.append(""); //NOI18N Type exType = ((ThrowsTag)tag).exceptionType(); if (exType != null) - createLink(thr, ctx.second.elementFor(exType.asClassDoc()), exType.simpleTypeName()); + createLink(thr, ctx.second().elementFor(exType.asClassDoc()), exType.simpleTypeName()); else thr.append(((ThrowsTag)tag).exceptionName()); thr.append(""); //NOI18N @@ -1181,7 +1181,7 @@ String label = stag.label(); if (memberName != null) { if (refClass != null) { - createLink(see, ctx.second.elementFor(stag.referencedMember()), "" + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + ""); //NOI18N + createLink(see, ctx.second().elementFor(stag.referencedMember()), "" + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + ""); //NOI18N } else { see.append(className); see.append('.'); //NOI18N @@ -1190,9 +1190,9 @@ see.append(", "); //NOI18N } else if (className != null) { if (refClass != null) { - createLink(see, ctx.second.elementFor(refClass), "" + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + ""); //NOI18N + createLink(see, ctx.second().elementFor(refClass), "" + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + ""); //NOI18N } else if (refPackage != null) { - createLink(see, ctx.second.elementFor(refPackage), "" + (label != null && label.length() > 0 ? label : refPackage.name()) + ""); //NOI18N + createLink(see, ctx.second().elementFor(refPackage), "" + (label != null && label.length() > 0 ? label : refPackage.name()) + ""); //NOI18N } else { see.append(className); } @@ -1262,7 +1262,7 @@ boolean plain = LINKPLAIN_TAG.equals(stag.name()); if (memberName != null) { if (refClass != null) { - createLink(sb, ctx.second.elementFor(stag.referencedMember()), (plain ? "" : "") + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + (plain ? "" : "")); //NOI18N + createLink(sb, ctx.second().elementFor(stag.referencedMember()), (plain ? "" : "") + (label != null && label.length() > 0 ? label : (refClass.simpleTypeName() + "." + memberName)) + (plain ? "" : "")); //NOI18N } else { sb.append(stag.referencedClassName()); sb.append('.'); //NOI18N @@ -1270,9 +1270,9 @@ } } else { if (refClass != null) { - createLink(sb, ctx.second.elementFor(refClass), (plain ? "" : "") + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + (plain ? "" : "")); //NOI18N + createLink(sb, ctx.second().elementFor(refClass), (plain ? "" : "") + (label != null && label.length() > 0 ? label : refClass.simpleTypeName()) + (plain ? "" : "")); //NOI18N } else if (refPackage != null) { - createLink(sb, ctx.second.elementFor(refPackage), (plain ? "" : "") + (label != null && label.length() > 0 ? label : refPackage.name()) + (plain ? "" : "")); //NOI18N + createLink(sb, ctx.second().elementFor(refPackage), (plain ? "" : "") + (label != null && label.length() > 0 ? label : refPackage.name()) + (plain ? "" : "")); //NOI18N } else { String className = stag.referencedClassName(); sb.append(className != null ? className : stag.text()); @@ -1383,7 +1383,7 @@ String tName = cd != null ? cd.name() : type.simpleTypeName(); if (cd != null && cd.isAnnotationType() && annotation) tName = "@" + tName; //NOI18N - len += createLink(sb, ctx.second.elementFor(type.asClassDoc()), tName); + len += createLink(sb, ctx.second().elementFor(type.asClassDoc()), tName); ParameterizedType pt = type.asParameterizedType(); if (pt != null) { Type[] targs = pt.typeArguments(); @@ -1433,7 +1433,7 @@ for (ClassDoc ifaceDoc : cdoc.interfaces()) { for (MethodDoc methodDoc : ifaceDoc.methods(false)) { if (mdoc.overrides(methodDoc)) { - Element e = ctx.second.elementFor(methodDoc); + Element e = ctx.second().elementFor(methodDoc); boolean isLocalized = false; if (e != null) { inheritedPage = JavadocHelper.getJavadoc(e, cancel); @@ -1441,7 +1441,7 @@ docURL = inheritedPage.getLocation(); } if (!(isLocalized = isLocalized(docURL, e))) - ctx.first.getTree(e); + ctx.first().getTree(e); } if (!isLocalized) { List inheritedInlineTags = null; @@ -1606,7 +1606,7 @@ if (superclass != null) { //NOI18N for (MethodDoc methodDoc : superclass.methods(false)) { if (mdoc.overrides(methodDoc)) { - Element e = ctx.second.elementFor(methodDoc); + Element e = ctx.second().elementFor(methodDoc); boolean isLocalized = false; if (e != null) { inheritedPage = JavadocHelper.getJavadoc(e, cancel); @@ -1614,7 +1614,7 @@ docURL = inheritedPage.getLocation(); } if (!(isLocalized = isLocalized(docURL, e))) - ctx.first.getTree(e); + ctx.first().getTree(e); } if (!isLocalized) { List inheritedInlineTags = null; diff --git a/javascript.editing/nbproject/project.xml b/javascript.editing/nbproject/project.xml --- a/javascript.editing/nbproject/project.xml +++ b/javascript.editing/nbproject/project.xml @@ -262,7 +262,7 @@ - 8.0 + 8.32 diff --git a/javascript.editing/src/org/netbeans/modules/javascript/editing/JsCodeCompletion.java b/javascript.editing/src/org/netbeans/modules/javascript/editing/JsCodeCompletion.java --- a/javascript.editing/src/org/netbeans/modules/javascript/editing/JsCodeCompletion.java +++ b/javascript.editing/src/org/netbeans/modules/javascript/editing/JsCodeCompletion.java @@ -99,6 +99,7 @@ import org.openide.util.Exceptions; import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * Code completion handler for JavaScript @@ -1222,8 +1223,8 @@ matches = index.getElements(prefix, fqn, kind, result); } else { Pair, Boolean> names = index.getAllNamesTruncated(prefix, kind, result); - matches = names.getA(); - boolean isTruncated = names.getB(); + matches = names.first(); + boolean isTruncated = names.second(); if (isTruncated) { request.completionResult.setTruncated(true); includeNonFqn = false; @@ -1446,8 +1447,8 @@ // return true; // } else { Pair, Boolean> names = index.getAllNamesTruncated(prefix, kind, result); - elements = names.getA(); - boolean isTruncated = names.getB(); + elements = names.first(); + boolean isTruncated = names.second(); if (isTruncated) { request.completionResult.setTruncated(true); } @@ -1583,8 +1584,8 @@ if (token.id() == JsTokenId.NEW) { Pair, Boolean> constructors = index.getConstructors(prefix, kind); - Set elements = constructors.getA(); - if (constructors.getB()) { + Set elements = constructors.first(); + if (constructors.second()) { request.completionResult.setTruncated(true); } String lhs = request.call.getLhs(); diff --git a/javascript.editing/src/org/netbeans/modules/javascript/editing/JsIndex.java b/javascript.editing/src/org/netbeans/modules/javascript/editing/JsIndex.java --- a/javascript.editing/src/org/netbeans/modules/javascript/editing/JsIndex.java +++ b/javascript.editing/src/org/netbeans/modules/javascript/editing/JsIndex.java @@ -61,6 +61,7 @@ import org.openide.filesystems.FileObject; import org.openide.filesystems.FileStateInvalidException; import org.openide.util.Exceptions; +import org.openide.util.Pair; /** * @@ -134,7 +135,7 @@ @SuppressWarnings("unchecked") public Set getAllNames(final String name, QuerySupport.Kind kind, JsParseResult context) { // TODO - search by the FIELD_CLASS thingy - return getUnknownFunctions(name, kind, false, context, true, true).getA(); + return getUnknownFunctions(name, kind, false, context, true, true).first(); } @SuppressWarnings("unchecked") @@ -351,13 +352,13 @@ elements.add(element); if (elements.size() == MAX_SEARCH_ITEMS) { - return new Pair,Boolean>(elements, true); + return Pair.,Boolean>of(elements, true); } } } } - return new Pair,Boolean>(elements, false); + return Pair.,Boolean>of(elements, false); } private Set getByFqn( diff --git a/javascript.editing/src/org/netbeans/modules/javascript/editing/Pair.java b/javascript.editing/src/org/netbeans/modules/javascript/editing/Pair.java deleted file mode 100644 --- a/javascript.editing/src/org/netbeans/modules/javascript/editing/Pair.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - */ -package org.netbeans.modules.javascript.editing; - -/** - * - * @author Jan Lahoda - */ -public final class Pair { - - private final A a; - private final B b; - - public Pair(A a, B b) { - this.a = a; - this.b = b; - } - - public A getA() { - return a; - } - - public B getB() { - return b; - } - - public static Pair of(A a, B b) { - return new Pair(a, b); - } -} diff --git a/jumpto/nbproject/project.xml b/jumpto/nbproject/project.xml --- a/jumpto/nbproject/project.xml +++ b/jumpto/nbproject/project.xml @@ -189,7 +189,7 @@ - 8.0 + 8.32 diff --git a/jumpto/src/org/netbeans/modules/jumpto/common/Models.java b/jumpto/src/org/netbeans/modules/jumpto/common/Models.java --- a/jumpto/src/org/netbeans/modules/jumpto/common/Models.java +++ b/jumpto/src/org/netbeans/modules/jumpto/common/Models.java @@ -48,6 +48,7 @@ import javax.swing.AbstractListModel; import javax.swing.ListModel; import org.netbeans.api.annotations.common.NonNull; +import org.openide.util.Pair; /** * (copied from org.netbeans.modules.java.source.util.Models diff --git a/jumpto/src/org/netbeans/modules/jumpto/common/Pair.java b/jumpto/src/org/netbeans/modules/jumpto/common/Pair.java deleted file mode 100644 --- a/jumpto/src/org/netbeans/modules/jumpto/common/Pair.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2012 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - * - * Contributor(s): - * - * Portions Copyrighted 2012 Sun Microsystems, Inc. - */ -package org.netbeans.modules.jumpto.common; - -import org.netbeans.api.annotations.common.NonNull; -import org.netbeans.api.annotations.common.NullAllowed; - -/** - * - * @author Tomas Zezula - */ -public final class Pair { - - public final F first; - public final S second; - - - private Pair( - @NullAllowed final F first, - @NullAllowed final S second) { - this.first = first; - this.second = second; - } - - @Override - public String toString() { - return String.format( - "Pair[%s,%s]", //NOI18N - first, - second); - } - - @Override - public int hashCode() { - int res = 17; - res = res * 31 + (first == null ? 0 : first.hashCode()); - res = res * 31 + (second == null ? 0 : second.hashCode()); - return res; - } - - @Override - public boolean equals(@NullAllowed final Object other) { - if (other == this) { - return true; - } - if (!(other instanceof Pair)) { - return false; - } - final Pair otherPair = (Pair) other; - return first == null ? otherPair.first == null : first.equals(otherPair.first) && - second == null ? otherPair.second == null : second.equals(otherPair.second); - } - - - @NonNull - public static Pair of( - @NullAllowed final F first, - @NullAllowed final S second) { - return new Pair(first,second); - } - -} diff --git a/jumpto/src/org/netbeans/modules/jumpto/file/FileSearchAction.java b/jumpto/src/org/netbeans/modules/jumpto/file/FileSearchAction.java --- a/jumpto/src/org/netbeans/modules/jumpto/file/FileSearchAction.java +++ b/jumpto/src/org/netbeans/modules/jumpto/file/FileSearchAction.java @@ -110,7 +110,6 @@ import org.netbeans.modules.jumpto.common.Factory; import org.netbeans.modules.jumpto.type.GoToTypeAction; import org.netbeans.modules.jumpto.common.Models; -import org.netbeans.modules.jumpto.common.Pair; import org.netbeans.modules.parsing.spi.indexing.support.IndexResult; import org.netbeans.modules.parsing.spi.indexing.support.QuerySupport; import org.netbeans.spi.jumpto.file.FileDescriptor; @@ -133,6 +132,7 @@ import org.openide.util.ImageUtilities; import org.openide.util.Lookup; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.RequestProcessor; import org.openide.util.Utilities; @@ -491,7 +491,7 @@ new Factory>() { @Override public FileDescriptor create(@NonNull final Pair param) { - return new AsyncFileDescriptor(param.first, param.second); + return new AsyncFileDescriptor(param.first(), param.second()); } }); diff --git a/maven.hints/nbproject/project.xml b/maven.hints/nbproject/project.xml --- a/maven.hints/nbproject/project.xml +++ b/maven.hints/nbproject/project.xml @@ -287,7 +287,7 @@ - 8.0 + 8.32 diff --git a/maven.hints/src/org/netbeans/modules/maven/hints/pom/Pair.java b/maven.hints/src/org/netbeans/modules/maven/hints/pom/Pair.java deleted file mode 100644 --- a/maven.hints/src/org/netbeans/modules/maven/hints/pom/Pair.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun - * Microsystems, Inc. All Rights Reserved. - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - */ - -package org.netbeans.modules.maven.hints.pom; - -/** - * - * @author Jan Lahoda - */ -public final class Pair { - - private A a; - private B b; - - public Pair(A a, B b) { - this.a = a; - this.b = b; - } - - public A getA() { - return a; - } - - public B getB() { - return b; - } - - @Override - public String toString() { - return "[" + String.valueOf(a) + "/" + String.valueOf(b) + "]"; - } -} diff --git a/maven.hints/src/org/netbeans/modules/maven/hints/pom/RulesManager.java b/maven.hints/src/org/netbeans/modules/maven/hints/pom/RulesManager.java --- a/maven.hints/src/org/netbeans/modules/maven/hints/pom/RulesManager.java +++ b/maven.hints/src/org/netbeans/modules/maven/hints/pom/RulesManager.java @@ -61,6 +61,7 @@ import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.loaders.DataObject; +import org.openide.util.Pair; /** Manages rules read from the system filesystem. * @@ -126,7 +127,7 @@ r = instantiateRule(o); } if ( r != null ) { - rules.add( new Pair( r, o ) ); + rules.add( Pair.of( r, o ) ); } } } @@ -140,8 +141,8 @@ dir2node.put(rootFolder, rootNode); for( Pair pair : rules ) { - POMErrorFixBase rule = pair.getA(); - FileObject fo = pair.getB(); + POMErrorFixBase rule = pair.first(); + FileObject fo = pair.second(); Object nonGuiObject = fo.getAttribute(NON_GUI); boolean toGui = true; diff --git a/maven.j2ee/manifest.mf b/maven.j2ee/manifest.mf --- a/maven.j2ee/manifest.mf +++ b/maven.j2ee/manifest.mf @@ -3,4 +3,4 @@ OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/maven/j2ee/Bundle.properties OpenIDE-Module-Layer: org/netbeans/modules/maven/j2ee/layer.xml AutoUpdate-Show-In-Client: false -OpenIDE-Module-Specification-Version: 1.34 +OpenIDE-Module-Specification-Version: 1.35 diff --git a/maven.j2ee/nbproject/project.xml b/maven.j2ee/nbproject/project.xml --- a/maven.j2ee/nbproject/project.xml +++ b/maven.j2ee/nbproject/project.xml @@ -324,7 +324,7 @@ - 1.27 + 1.28 diff --git a/openide.util/apichanges.xml b/openide.util/apichanges.xml --- a/openide.util/apichanges.xml +++ b/openide.util/apichanges.xml @@ -51,6 +51,21 @@ Actions API + + + Added a type safe Pair of 2 elements + + + + + +

+ Added a type safe Pair of 2 elements. +

+
+ + +
Automatic support for UserQuestionException diff --git a/openide.util/manifest.mf b/openide.util/manifest.mf --- a/openide.util/manifest.mf +++ b/openide.util/manifest.mf @@ -1,5 +1,5 @@ Manifest-Version: 1.0 OpenIDE-Module: org.openide.util OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties -OpenIDE-Module-Specification-Version: 8.31 +OpenIDE-Module-Specification-Version: 8.32 diff --git a/openide.util/src/org/openide/util/Pair.java b/openide.util/src/org/openide/util/Pair.java new file mode 100644 --- /dev/null +++ b/openide.util/src/org/openide/util/Pair.java @@ -0,0 +1,114 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2013 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2013 Sun Microsystems, Inc. + */ +package org.openide.util; + +/** + * A type safe pair of two object. + * @author Tomas Zezula + * @since 8.32 + */ +public final class Pair { + + private final First first; + private final Second second; + + + private Pair(final First first, final Second second) { + this.first = first; + this.second = second; + } + + /** + * Returns the first element of the {@link Pair}. + * @return the first element. + */ + public First first() { + return first; + } + + /** + * Returns the second element of the {@link Pair}. + * @return the second element. + */ + public Second second() { + return second; + } + + @Override + public String toString () { + return String.format("Pair[%s,%s]", first,second); //NOI18N + } + + @Override + public boolean equals(final Object other) { + if (other == this) { + return true; + } + if (!(other instanceof Pair)) { + return false; + } + final Pair otherPair = (Pair) other; + return (first == null ? otherPair.first == null : first.equals(otherPair.first)) && + (second == null ? otherPair.second == null : second.equals(otherPair.second)); + } + + @Override + public int hashCode() { + int res = 17; + res = res * 31 + (first == null ? 0 : first.hashCode()); + res = res * 31 + (second == null ? 0 : second.hashCode()); + return res; + } + + + /** + * Creates a new Pair. + * @param the type of the first element + * @param the type of the second element + * @param first the first element + * @param second the second element + * @return the new {@link Pair} of the first and second elements. + */ + public static Pair of (final First first, final Second second) { + return new Pair(first, second); + } +} diff --git a/openide.util/test/unit/src/org/openide/util/PairTest.java b/openide.util/test/unit/src/org/openide/util/PairTest.java new file mode 100644 --- /dev/null +++ b/openide.util/test/unit/src/org/openide/util/PairTest.java @@ -0,0 +1,79 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2013 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2013 Sun Microsystems, Inc. + */ +package org.openide.util; + +import org.netbeans.junit.NbTestCase; + +/** + * + * @author Tomas Zezula + */ +public class PairTest extends NbTestCase { + + public PairTest(String name) { + super(name); + } + + + public void testPairs() { + final Pair p1a = Pair.of(1, 1); + final Pair p1b = Pair.of(1, 1); + final Pair p2 = Pair.of(1, 2); + final Pair p3 = Pair.of(2, 1); + final Pair p4 = Pair.of(null, 1); + final Pair p5 = Pair.of(1, null); + final Pair p6 = Pair.of(null, null); + assertTrue(p1a.equals(p1a)); + assertTrue(p1a.equals(p1b)); + assertFalse(p1a.equals(p2)); + assertFalse(p1a.equals(p3)); + assertFalse(p1a.equals(p4)); + assertFalse(p1a.equals(p5)); + assertFalse(p1a.equals(p6)); + assertEquals(p1a.hashCode(), p1b.hashCode()); + assertEquals(p4.hashCode(), p4.hashCode()); + assertEquals(p5.hashCode(), p5.hashCode()); + assertEquals(p6.hashCode(), p6.hashCode()); + assertFalse(p4.hashCode() == p5.hashCode()); + } + +} diff --git a/parsing.api/nbproject/project.xml b/parsing.api/nbproject/project.xml --- a/parsing.api/nbproject/project.xml +++ b/parsing.api/nbproject/project.xml @@ -218,7 +218,7 @@ - 8.25 + 8.32
diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/SourceCache.java b/parsing.api/src/org/netbeans/modules/parsing/impl/SourceCache.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/SourceCache.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/SourceCache.java @@ -63,7 +63,6 @@ import org.netbeans.modules.parsing.api.Snapshot; import org.netbeans.modules.parsing.api.Source; import org.netbeans.modules.parsing.api.Task; -import org.netbeans.modules.parsing.impl.indexing.Pair; import org.netbeans.modules.parsing.spi.EmbeddingProvider; import org.netbeans.modules.parsing.spi.ParseException; import org.netbeans.modules.parsing.spi.Parser; @@ -76,6 +75,7 @@ import org.netbeans.modules.parsing.spi.Scheduler; import org.openide.filesystems.FileObject; import org.openide.util.Lookup; +import org.openide.util.Pair; /** diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/TaskProcessor.java b/parsing.api/src/org/netbeans/modules/parsing/impl/TaskProcessor.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/TaskProcessor.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/TaskProcessor.java @@ -79,13 +79,13 @@ import org.netbeans.modules.parsing.api.Task; import org.netbeans.modules.parsing.api.UserTask; import org.netbeans.modules.parsing.api.indexing.IndexingManager; -import org.netbeans.modules.parsing.impl.indexing.Pair; import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater; import org.netbeans.modules.parsing.impl.indexing.Util; import org.netbeans.modules.parsing.spi.*; import org.netbeans.modules.parsing.spi.Parser.Result; import org.openide.util.Exceptions; import org.openide.util.Mutex; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.RequestProcessor; @@ -476,12 +476,12 @@ Parameters.notNull("cache", cache); //NOI18N List _requests = new ArrayList (); for (Pair> task : tasks) { - final String taskClassName = task.first.getClass().getName(); + final String taskClassName = task.first().getClass().getName(); if (excludedTasks != null && excludedTasks.matcher(taskClassName).matches()) { if (includedTasks == null || !includedTasks.matcher(taskClassName).matches()) continue; } - _requests.add (new Request (task.first, cache, bridge ? ReschedulePolicy.ON_CHANGE : ReschedulePolicy.CANCELED, task.second)); + _requests.add (new Request (task.first(), cache, bridge ? ReschedulePolicy.ON_CHANGE : ReschedulePolicy.CANCELED, task.second())); } return _requests; } diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/Utilities.java b/parsing.api/src/org/netbeans/modules/parsing/impl/Utilities.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/Utilities.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/Utilities.java @@ -50,12 +50,12 @@ import org.netbeans.modules.masterfs.providers.ProvidedExtensions; import org.netbeans.modules.parsing.api.Source; import org.netbeans.modules.parsing.impl.event.EventSupport; -import org.netbeans.modules.parsing.impl.indexing.Pair; import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater; import org.netbeans.modules.parsing.spi.Parser; import org.netbeans.modules.parsing.spi.ParserResultTask; import org.netbeans.modules.parsing.spi.Scheduler; import org.netbeans.modules.parsing.spi.SchedulerTask; +import org.openide.util.Pair; import org.openide.util.Parameters; /** diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ArchiveTimeStamps.java b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ArchiveTimeStamps.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ArchiveTimeStamps.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ArchiveTimeStamps.java @@ -56,6 +56,7 @@ import org.openide.filesystems.FileUtil; import org.openide.util.EditableProperties; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.RequestProcessor; @@ -158,17 +159,17 @@ @NonNull private static String generate(Pair,Integer>> data) { final StringBuilder sb = new StringBuilder(); - for (Map.Entry,Integer> r : data.second.entrySet()) { + for (Map.Entry,Integer> r : data.second().entrySet()) { final Pair key = r.getKey(); - assert key.first.indexOf(SEPARATOR) < 0; - sb.append(key.first); + assert key.first().indexOf(SEPARATOR) < 0; + sb.append(key.first()); sb.append(SEPARATOR); - sb.append(key.second); + sb.append(key.second()); sb.append(SEPARATOR); sb.append(r.getValue()); sb.append(SEPARATOR); } - sb.append(data.first); + sb.append(data.first()); return sb.toString(); } diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java @@ -72,6 +72,7 @@ import org.netbeans.modules.parsing.lucene.support.DocumentIndexCache; import org.netbeans.modules.parsing.lucene.support.IndexDocument; import org.netbeans.modules.parsing.spi.indexing.Indexable; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.Utilities; @@ -725,10 +726,10 @@ MessageFormat.format( "{0} : Attached at: {1} by: {2}, Detached at: {3} by: {4}", //NOI18N reason, - attach == null ? null : attach.first, - attach == null ? null : Arrays.asList(attach.second), - detach == null ? null : detach.first, - detach == null ? null : Arrays.asList(detach.second))); + attach == null ? null : attach.first(), + attach == null ? null : Arrays.asList(attach.second()), + detach == null ? null : detach.first(), + detach == null ? null : Arrays.asList(detach.second()))); } } diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/FileEventLog.java b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/FileEventLog.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/FileEventLog.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/FileEventLog.java @@ -52,6 +52,7 @@ import java.util.logging.Logger; import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.Work; import org.openide.filesystems.FileEvent; +import org.openide.util.Pair; /** * @@ -123,14 +124,14 @@ if (myChanges != null) { for (Map> changesInRoot : myChanges.values()) { for (Pair desc : changesInRoot.values()) { - if (desc.first == FileOp.DELETE) { - if (!seenDelete.containsKey(desc.second)) { - first.add(desc.second); - seenDelete.put(desc.second, desc.second); + if (desc.first() == FileOp.DELETE) { + if (!seenDelete.containsKey(desc.second())) { + first.add(desc.second()); + seenDelete.put(desc.second(), desc.second()); } } else { - rest.add(desc.second); + rest.add(desc.second()); } } } diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/FileObjectCrawler.java b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/FileObjectCrawler.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/FileObjectCrawler.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/FileObjectCrawler.java @@ -65,6 +65,7 @@ import org.netbeans.modules.parsing.spi.indexing.Indexable; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; +import org.openide.util.Pair; /** * diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/IndexBinaryWorkPool.java b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/IndexBinaryWorkPool.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/IndexBinaryWorkPool.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/IndexBinaryWorkPool.java @@ -52,6 +52,7 @@ import java.util.logging.Logger; import org.netbeans.api.annotations.common.NonNull; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.RequestProcessor; /** diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/LogContext.java b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/LogContext.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/LogContext.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/LogContext.java @@ -49,6 +49,7 @@ import org.netbeans.api.java.classpath.ClassPath; import org.openide.filesystems.FileObject; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.RequestProcessor; import org.openide.util.Utilities; @@ -1038,11 +1039,11 @@ return; } - LOG.log(Level.WARNING, "Excessive indexing rate detected: " + dataSize(found.first, found.second) + " in " + minutes + "mins, treshold is " + treshold + + LOG.log(Level.WARNING, "Excessive indexing rate detected: " + dataSize(found.first(), found.second()) + " in " + minutes + "mins, treshold is " + treshold + ". Dumping suspicious contexts"); int index; - for (index = found.first; index != found.second; index = (index + 1) % times.length) { + for (index = found.first(); index != found.second(); index = (index + 1) % times.length) { contexts[index].log(false, false); } LOG.log(Level.WARNING, "=== End excessive indexing"); diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/Pair.java b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/Pair.java deleted file mode 100644 --- a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/Pair.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - * - * Contributor(s): - * - * Portions Copyrighted 2009 Sun Microsystems, Inc. - */ - -package org.netbeans.modules.parsing.impl.indexing; - -/** - * - * @author Tomas Zezula - */ -public final class Pair { - - public final P first; - public final K second; - - private Pair (P first, K second) { - this.first = first; - this.second = second; - } - - - public static Pair of (P first, K second) { - return new Pair (first,second); - } - - - @Override - public int hashCode () { - int hashCode = 0; - hashCode ^= first == null ? 0 : first.hashCode(); - hashCode ^= second == null ? 0: second.hashCode(); - return hashCode; - } - - @Override - public boolean equals (final Object other) { - if (other instanceof Pair) { - Pair otherPair = (Pair) other; - return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) && - (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second)); - } - return false; - } - - @Override - public String toString () { - return String.format("Pair[%s,%s]", first,second); - } -} diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java @@ -126,6 +126,7 @@ import org.openide.util.Lookup; import org.openide.util.Mutex.ExceptionAction; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.RequestProcessor; import org.openide.util.TopologicalSortException; @@ -626,20 +627,20 @@ if (fo != null && fo.isValid()) { if (source == null || source.booleanValue()) { root = getOwningSourceRoot(fo); - if (root != null && visibilitySupport.isVisible(fo, root.second)) { - if (root.second == null) { + if (root != null && visibilitySupport.isVisible(fo, root.second())) { + if (root.second() == null) { LOGGER.log( Level.INFO, "Ignoring event from non existing FileObject {0}", //NOI18N - root.first); + root.first()); return; } - boolean sourcForBinaryRoot = sourcesForBinaryRoots.contains(root.first); - ClassPath.Entry entry = sourcForBinaryRoot ? null : getClassPathEntry(root.second); + boolean sourcForBinaryRoot = sourcesForBinaryRoots.contains(root.first()); + ClassPath.Entry entry = sourcForBinaryRoot ? null : getClassPathEntry(root.second()); if (entry == null || entry.includes(fo)) { Work wrk; - if (fo.equals(root.second)) { - if (scannedRoots2Dependencies.get(root.first) == EMPTY_DEPS) { + if (fo.equals(root.second())) { + if (scannedRoots2Dependencies.get(root.first()) == EMPTY_DEPS) { //For first time seeing valid root do roots work to recalculate dependencies wrk = new RootsWork( scannedRoots2Dependencies, @@ -649,7 +650,7 @@ false, scannedRoots2DependenciesLamport, suspendSupport.getSuspendStatus(), - LogContext.create(LogContext.EventType.FILE, null).addRoots(Collections.singleton(root.first))); + LogContext.create(LogContext.EventType.FILE, null).addRoots(Collections.singleton(root.first()))); } else { //Already seen files work is enough final FileObject[] children = fo.getChildren(); @@ -657,7 +658,7 @@ if (children.length > 0) { wrk = new FileListWork( scannedRoots2Dependencies, - root.first, + root.first(), c, false, false, @@ -666,7 +667,7 @@ true, suspendSupport.getSuspendStatus(), LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). + withRoot(root.first()). addFileObjects(c)); } else { //If no children nothing needs to be done - save some CPU time @@ -677,7 +678,7 @@ Collection c = Collections.singleton(fo); wrk = new FileListWork( scannedRoots2Dependencies, - root.first, + root.first(), c, false, false, @@ -686,11 +687,11 @@ true, suspendSupport.getSuspendStatus(), LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). + withRoot(root.first()). addFileObjects(c)); } if (wrk != null) { - eventQueue.record(FileEventLog.FileOp.CREATE, root.first, FileUtil.getRelativePath(root.second, fo), fe, wrk); + eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), FileUtil.getRelativePath(root.second(), fo), fe, wrk); } processed = true; } @@ -699,14 +700,14 @@ if (!processed && (source == null || !source.booleanValue())) { root = getOwningBinaryRoot(fo); - if (root != null && visibilitySupport.isVisible(fo, root.second)) { + if (root != null && visibilitySupport.isVisible(fo, root.second())) { final Work wrk = new BinaryWork( - root.first, + root.first(), suspendSupport.getSuspendStatus(), LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). + withRoot(root.first()). addFileObjects(Collections.singleton(fo))); - eventQueue.record(FileEventLog.FileOp.CREATE, root.first, null, fe, wrk); + eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), null, fe, wrk); processed = true; } } @@ -734,20 +735,20 @@ if (fo != null && fo.isValid()) { if (source == null || source.booleanValue()) { root = getOwningSourceRoot (fo); - if (root != null && visibilitySupport.isVisible(fo,root.second)) { - if (root.second == null) { + if (root != null && visibilitySupport.isVisible(fo,root.second())) { + if (root.second() == null) { LOGGER.log( Level.INFO, "Ignoring event from non existing FileObject {0}", //NOI18N - root.first); + root.first()); return; } - boolean sourceForBinaryRoot = sourcesForBinaryRoots.contains(root.first); - ClassPath.Entry entry = sourceForBinaryRoot ? null : getClassPathEntry(root.second); + boolean sourceForBinaryRoot = sourcesForBinaryRoots.contains(root.first()); + ClassPath.Entry entry = sourceForBinaryRoot ? null : getClassPathEntry(root.second()); if (entry == null || entry.includes(fo)) { final Work wrk = new FileListWork( scannedRoots2Dependencies, - root.first, + root.first(), Collections.singleton(fo), false, false, @@ -756,9 +757,9 @@ true, suspendSupport.getSuspendStatus(), LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). + withRoot(root.first()). addFiles(Collections.singleton(fo.toURL()))); - eventQueue.record(FileEventLog.FileOp.CREATE, root.first, FileUtil.getRelativePath(root.second, fo), fe, wrk); + eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), FileUtil.getRelativePath(root.second(), fo), fe, wrk); processed = true; } } @@ -766,14 +767,14 @@ if (!processed && (source == null || !source.booleanValue())) { root = getOwningBinaryRoot(fo); - if (root != null && visibilitySupport.isVisible(fo,root.second)) { + if (root != null && visibilitySupport.isVisible(fo,root.second())) { final Work wrk = new BinaryWork( - root.first, + root.first(), suspendSupport.getSuspendStatus(), LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). + withRoot(root.first()). addFiles(Collections.singleton(fo.toURL()))); - eventQueue.record(FileEventLog.FileOp.CREATE, root.first, null, fe, wrk); + eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), null, fe, wrk); processed = true; } } @@ -807,24 +808,24 @@ if (fo != null) { if (source == null || source.booleanValue()) { root = getOwningSourceRoot (fo); - if (root != null && fo.isData() && visibilitySupport.isVisible(fo, root.second)) { + if (root != null && fo.isData() && visibilitySupport.isVisible(fo, root.second())) { String relativePath = null; try { //Root may be deleted -> no root.second available - if (root.second != null) { - relativePath = FileUtil.getRelativePath(root.second, fo); + if (root.second() != null) { + relativePath = FileUtil.getRelativePath(root.second(), fo); } else { - relativePath = root.first.toURI().relativize(fo.getURL().toURI()).getPath(); + relativePath = root.first().toURI().relativize(fo.getURL().toURI()).getPath(); } assert relativePath != null : "FileObject not under root: f=" + fo + ", root=" + root; //NOI18N final Work wrk = new DeleteWork( - root.first, + root.first(), Collections.singleton(relativePath), suspendSupport.getSuspendStatus(), LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). + withRoot(root.first()). addFiles(Collections.singleton(fo.toURL()))); - eventQueue.record(FileEventLog.FileOp.DELETE, root.first, relativePath, fe, wrk); + eventQueue.record(FileEventLog.FileOp.DELETE, root.first(), relativePath, fe, wrk); processed = true; } catch (FileStateInvalidException fse) { Exceptions.printStackTrace(fse); @@ -836,14 +837,14 @@ if (!processed && (source == null || !source.booleanValue())) { root = getOwningBinaryRoot(fo); - if (root != null && visibilitySupport.isVisible(fo, root.second)) { + if (root != null && visibilitySupport.isVisible(fo, root.second())) { final Work wrk = new BinaryWork( - root.first, + root.first(), suspendSupport.getSuspendStatus(), LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). + withRoot(root.first()). addFiles(Collections.singleton(fo.toURL()))); - eventQueue.record(FileEventLog.FileOp.DELETE, root.first, null, fe, wrk); + eventQueue.record(FileEventLog.FileOp.DELETE, root.first(), null, fe, wrk); processed = true; } } @@ -879,14 +880,14 @@ if (source == null || source.booleanValue()) { root = getOwningSourceRoot(newFile); if (root != null) { - if (root.second == null) { + if (root.second() == null) { LOGGER.log( Level.INFO, "Ignoring event from non existing FileObject {0}", //NOI18N - root.first); + root.first()); return; } - FileObject rootFo = root.second; + FileObject rootFo = root.second(); if (rootFo.equals(newFile)) { //Root renamed do nothing, will be fired as ClassPath change. return; @@ -895,35 +896,35 @@ String oldFilePath = ownerPath.length() == 0 ? oldNameExt : ownerPath + "/" + oldNameExt; //NOI18N if (newFile.isData()) { final Work work = new DeleteWork( - root.first, + root.first(), Collections.singleton(oldFilePath), suspendSupport.getSuspendStatus(), LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). + withRoot(root.first()). addFilePaths(Collections.singleton(oldFilePath))); - eventQueue.record(FileEventLog.FileOp.DELETE, root.first, oldFilePath, fe, work); + eventQueue.record(FileEventLog.FileOp.DELETE, root.first(), oldFilePath, fe, work); } else { Set oldFilePaths = new HashSet(); collectFilePaths(newFile, oldFilePath, oldFilePaths); for (String path : oldFilePaths) { final Work work = new DeleteWork( - root.first, + root.first(), oldFilePaths, suspendSupport.getSuspendStatus(), LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). + withRoot(root.first()). addFilePaths(oldFilePaths)); - eventQueue.record(FileEventLog.FileOp.DELETE, root.first, path, fe, work); + eventQueue.record(FileEventLog.FileOp.DELETE, root.first(), path, fe, work); } } - if (visibilitySupport.isVisible(newFile,root.second)) { - final boolean sourceForBinaryRoot = sourcesForBinaryRoots.contains(root.first); + if (visibilitySupport.isVisible(newFile,root.second())) { + final boolean sourceForBinaryRoot = sourcesForBinaryRoots.contains(root.first()); ClassPath.Entry entry = sourceForBinaryRoot ? null : getClassPathEntry(rootFo); if (entry == null || entry.includes(newFile)) { final FileListWork flw = new FileListWork( scannedRoots2Dependencies, - root.first, + root.first(), Collections.singleton(newFile), false, false, @@ -932,9 +933,9 @@ true, suspendSupport.getSuspendStatus(), LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). + withRoot(root.first()). addFileObjects(Collections.singleton(newFile))); - eventQueue.record(FileEventLog.FileOp.CREATE, root.first, FileUtil.getRelativePath(rootFo, newFile), fe,flw); + eventQueue.record(FileEventLog.FileOp.CREATE, root.first(), FileUtil.getRelativePath(rootFo, newFile), fe,flw); } } processed = true; @@ -964,14 +965,14 @@ eventQueue.record( FileEventLog.FileOp.CREATE, - root.first, + root.first(), null, fe, - new BinaryWork(root.first, + new BinaryWork(root.first(), suspendSupport.getSuspendStatus(), LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). - addRoots(Collections.singleton(root.first)))); + withRoot(root.first()). + addRoots(Collections.singleton(root.first())))); processed = true; } } @@ -1076,9 +1077,9 @@ Document doc = jtc.getDocument(); Pair root = getOwningSourceRoot(doc); if (root != null) { - if (root.second == null) { + if (root.second() == null) { final FileObject file = Util.getFileObject(doc); - assert file == null || !file.isValid() : "Expecting both owningSourceRootUrl=" + root.first + " and owningSourceRoot=" + root.second; //NOI18N + assert file == null || !file.isValid() : "Expecting both owningSourceRootUrl=" + root.first() + " and owningSourceRoot=" + root.second(); //NOI18N return; } long version = DocumentUtilities.getDocumentVersion(doc); @@ -1109,26 +1110,26 @@ if (reindex) { // we have already seen the document and it's been modified since the last time if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.fine("Document modified (reindexing): " + FileUtil.getFileDisplayName(docFile) + " Owner: " + root.first); //NOI18N + LOGGER.fine("Document modified (reindexing): " + FileUtil.getFileDisplayName(docFile) + " Owner: " + root.first()); //NOI18N } - FileListWork job = jobs.get(root.first); + FileListWork job = jobs.get(root.first()); if (job == null) { Collection c = Collections.singleton(docFile); job = new FileListWork( scannedRoots2Dependencies, - root.first, + root.first(), c, false, openedInEditor, true, - sourcesForBinaryRoots.contains(root.first), + sourcesForBinaryRoots.contains(root.first()), true, suspendSupport.getSuspendStatus(), LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). + withRoot(root.first()). addFileObjects(c)); - jobs.put(root.first, job); + jobs.put(root.first(), job); } else { // XXX: strictly speaking we should set 'checkEditor' for each file separately // and not for each job; in reality we normally do not end up here @@ -1301,11 +1302,11 @@ final Pair root = getOwningSourceRoot(document); if (root != null) { - if (root.second == null) { + if (root.second() == null) { LOGGER.log( Level.INFO, "Ignoring event from non existing FileObject {0}", //NOI18N - root.first); + root.first()); return; } if (activeDocument == document) { @@ -1326,10 +1327,10 @@ // An active document was modified, we've indexed that document berfore, // so mark it dirty if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.fine("Active document modified (marking dirty): " + FileUtil.getFileDisplayName(docFile) + " Owner: " + root.first); //NOI18N + LOGGER.fine("Active document modified (marking dirty): " + FileUtil.getFileDisplayName(docFile) + " Owner: " + root.first()); //NOI18N } - Collection dirty = Collections.singleton(SPIAccessor.getInstance().create(new FileObjectIndexable(root.second, docFile))); + Collection dirty = Collections.singleton(SPIAccessor.getInstance().create(new FileObjectIndexable(root.second(), docFile))); String mimeType = DocumentUtilities.getMimeType(document); TransientUpdateSupport.setTransientUpdate(true); @@ -1340,7 +1341,7 @@ @Override public FileObject call() throws Exception { if (cache == null) { - cache = CacheFolder.getDataFolder(root.first); + cache = CacheFolder.getDataFolder(root.first()); } return cache; } @@ -1351,7 +1352,7 @@ final CustomIndexerFactory factory = info.getIndexerFactory(); final Context ctx = SPIAccessor.getInstance().createContext( indexFolderFactory, - root.first, + root.first(), factory.getIndexerName(), factory.getIndexVersion(), null, @@ -1373,7 +1374,7 @@ final EmbeddingIndexerFactory factory = info.getIndexerFactory(); final Context ctx = SPIAccessor.getInstance().createContext( indexFolderFactory, - root.first, + root.first(), factory.getIndexerName(), factory.getIndexVersion(), null, @@ -1398,7 +1399,7 @@ FileObject f = Util.getFileObject(document); Collection c = Collections.singleton(f.getURL()); addIndexingJob( - root.first, + root.first(), c, false, true, @@ -1406,7 +1407,7 @@ true, true, LogContext.create(LogContext.EventType.FILE, null). - withRoot(root.first). + withRoot(root.first()). addFiles(c)); } catch (FileStateInvalidException ex) { LOGGER.log(Level.WARNING, null, ex); @@ -2200,7 +2201,7 @@ } logStartIndexer(factory.getIndexerName()); try { - boolean vote = factory.scanStarted(value.second); + boolean vote = factory.scanStarted(value.second()); votes.put(factory,vote); } catch (Throwable t) { if (t instanceof ThreadDeath) { @@ -2246,7 +2247,7 @@ } logStartIndexer(eif.getIndexerName()); try { - boolean vote = eif.scanStarted(value.second); + boolean vote = eif.scanStarted(value.second()); votes.put(eif, vote); } catch (Throwable t) { if (t instanceof ThreadDeath) { @@ -2270,14 +2271,14 @@ parkWhileSuspended(); if (TEST_LOGGER.isLoggable(Level.FINEST)) { TEST_LOGGER.log(Level.FINEST, "scanFinishing:{0}:{1}", - new Object[] { entry.first.getIndexerName(), entry.second.getRootURI().toExternalForm() }); + new Object[] { entry.first().getIndexerName(), entry.second().getRootURI().toExternalForm() }); } - logStartIndexer(entry.first.getIndexerName()); - SPIAccessor.getInstance().putProperty(entry.second, ClusteredIndexables.DELETE, null); - SPIAccessor.getInstance().putProperty(entry.second, ClusteredIndexables.INDEX, null); + logStartIndexer(entry.first().getIndexerName()); + SPIAccessor.getInstance().putProperty(entry.second(), ClusteredIndexables.DELETE, null); + SPIAccessor.getInstance().putProperty(entry.second(), ClusteredIndexables.INDEX, null); cancelRequest.setResult(finished); try { - entry.first.scanFinished(entry.second); + entry.first().scanFinished(entry.second()); } catch (Throwable t) { if (t instanceof ThreadDeath) { throw (ThreadDeath) t; @@ -2287,10 +2288,10 @@ } finally { cancelRequest.setResult(null); } - logFinishIndexer(entry.first.getIndexerName()); + logFinishIndexer(entry.first().getIndexerName()); if (TEST_LOGGER.isLoggable(Level.FINEST)) { TEST_LOGGER.log(Level.FINEST, "scanFinished:{0}:{1}", - new Object[] { entry.first.getIndexerName(), entry.second.getRootURI().toExternalForm() }); + new Object[] { entry.first().getIndexerName(), entry.second().getRootURI().toExternalForm() }); } } } finally { @@ -2298,14 +2299,14 @@ boolean indexOk = true; for(Pair entry : ctxToFinish) { indexOk &= storeChanges( - entry.first.getIndexerName(), - entry.second, + entry.first().getIndexerName(), + entry.second(), isSteady(), usedIterables.get(), finished); } if (!indexOk) { - final Context ctx = ctxToFinish.iterator().next().second; + final Context ctx = ctxToFinish.iterator().next().second(); RepositoryUpdater.getDefault().addIndexingJob( ctx.getRootURI(), null, @@ -2336,12 +2337,12 @@ try { for (Pair pair : contexts.values()) { parkWhileSuspended(); - SPIAccessor.getInstance().putProperty(pair.second, ClusteredIndexables.DELETE, ci); - pair.first.filesDeleted(ci.getIndexablesFor(null), pair.second); + SPIAccessor.getInstance().putProperty(pair.second(), ClusteredIndexables.DELETE, ci); + pair.first().filesDeleted(ci.getIndexablesFor(null), pair.second()); } } finally { for(Pair pair : contexts.values()) { - DocumentIndex index = SPIAccessor.getInstance().getIndexFactory(pair.second).getIndex(pair.second.getIndexFolder()); + DocumentIndex index = SPIAccessor.getInstance().getIndexFactory(pair.second()).getIndex(pair.second().getIndexFolder()); if (index != null) { usedIterables.offer(ci.getIndexablesFor(null)); } @@ -2435,7 +2436,7 @@ factory }); } - SPIAccessor.getInstance().setAllFilesJob(value.second, allFiles); + SPIAccessor.getInstance().setAllFilesJob(value.second(), allFiles); List> indexerIndexablesList = new LinkedList>(); ClusteredIndexables usedCi = null; for(String mimeType : cifInfo.getMimeTypes()) { @@ -2466,10 +2467,10 @@ final CustomIndexer indexer = factory.createIndexer(); long tm1 = -1, tm2 = -1; logStartIndexer(factory.getIndexerName()); - SPIAccessor.getInstance().putProperty(value.second, ClusteredIndexables.INDEX, usedCi); + SPIAccessor.getInstance().putProperty(value.second(), ClusteredIndexables.INDEX, usedCi); try { tm1 = System.currentTimeMillis(); - SPIAccessor.getInstance().index(indexer, indexables, value.second); + SPIAccessor.getInstance().index(indexer, indexables, value.second()); } catch (ThreadDeath td) { throw td; } catch (Throwable t) { @@ -2551,7 +2552,7 @@ value = Pair.of(factory,ctx); contexts.put(key,value); } - SPIAccessor.getInstance().setAllFilesJob(value.second, allFiles); + SPIAccessor.getInstance().setAllFilesJob(value.second(), allFiles); } } } @@ -2705,15 +2706,15 @@ protected final boolean checkBinaryIndexers( @NullAllowed Pair,Integer>> lastState, @NonNull Map contexts) throws IOException { - if (lastState == null || lastState.first == 0L) { + if (lastState == null || lastState.first() == 0L) { //Nothing known about the last state return false; } - if (contexts.size() != lastState.second.size()) { + if (contexts.size() != lastState.second().size()) { //Factories changed return false; } - final Map,Integer> copy = new HashMap,Integer>(lastState.second); + final Map,Integer> copy = new HashMap,Integer>(lastState.second()); for (Map.Entry e : contexts.entrySet()) { final BinaryIndexerFactory bif = e.getKey(); final Integer state = copy.remove(Pair.of(bif.getIndexerName(),bif.getIndexVersion())); @@ -2866,11 +2867,11 @@ final EmbeddingIndexer indexer = indexerFactory.createIndexer(dirty, pr.getSnapshot()); if (indexer != null) { - SPIAccessor.getInstance().putProperty(value.second, ClusteredIndexables.INDEX, usedCi); + SPIAccessor.getInstance().putProperty(value.second(), ClusteredIndexables.INDEX, usedCi); long st = System.currentTimeMillis(); logStartIndexer(indexerName); try { - SPIAccessor.getInstance().index(indexer, dirty, pr, value.second); + SPIAccessor.getInstance().index(indexer, dirty, pr, value.second()); } catch (ThreadDeath td) { throw td; } catch (Throwable t) { @@ -3672,7 +3673,7 @@ final Pair indexerKey = Pair.of(factory.getIndexerName(),factory.getIndexVersion()); final Pair ctx = transactionContexts.get(indexerKey); if (ctx != null) { - SPIAccessor.getInstance().setAllFilesJob(ctx.second, true); + SPIAccessor.getInstance().setAllFilesJob(ctx.second(), true); final CustomIndexer indexer = factory.createIndexer(); if (LOGGER.isLoggable(Level.FINE)) { StringBuilder sb = printMimeTypes(cifInfo.getMimeTypes(), new StringBuilder()); @@ -3685,11 +3686,11 @@ sb }); } - SPIAccessor.getInstance().putProperty(ctx.second, ClusteredIndexables.INDEX, ci); + SPIAccessor.getInstance().putProperty(ctx.second(), ClusteredIndexables.INDEX, ci); long st = System.currentTimeMillis(); logStartIndexer(factory.getIndexerName()); try { - SPIAccessor.getInstance().index(indexer, indexables, ctx.second); + SPIAccessor.getInstance().index(indexer, indexables, ctx.second()); } catch (ThreadDeath td) { throw td; } catch (Throwable t) { @@ -3969,13 +3970,13 @@ for(Pair fileOrFileObject : suspectFilesOrFileObjects) { Pair fileObject = null; - if (fileOrFileObject.first instanceof File) { - FileObject f = FileUtil.toFileObject((File) fileOrFileObject.first); + if (fileOrFileObject.first() instanceof File) { + FileObject f = FileUtil.toFileObject((File) fileOrFileObject.first()); if (f != null) { - fileObject = Pair.of(f, fileOrFileObject.second); + fileObject = Pair.of(f, fileOrFileObject.second()); } - } else if (fileOrFileObject.first instanceof FileObject) { - fileObject = Pair.of((FileObject) fileOrFileObject.first, fileOrFileObject.second); + } else if (fileOrFileObject.first() instanceof FileObject) { + fileObject = Pair.of((FileObject) fileOrFileObject.first(), fileOrFileObject.second()); } else { LOGGER.fine("Not File or FileObject, ignoring: " + fileOrFileObject); //NOI18N } @@ -3993,7 +3994,7 @@ if (rootFile != null) { FileObject rootFo = FileUtil.toFileObject(rootFile); if (rootFo != null) { - if (f.first == rootFo || FileUtil.isParentOf(f.first, rootFo)) { + if (f.first() == rootFo || FileUtil.isParentOf(f.first(), rootFo)) { depCtx.newBinariesToScan.add(root); break; } @@ -4003,7 +4004,7 @@ // check roots that own a suspect FileObject rootFo = URLCache.getInstance().findFileObject(root, true); if (rootFo != null) { - if (f.first == rootFo || FileUtil.isParentOf(rootFo, f.first)) { + if (f.first() == rootFo || FileUtil.isParentOf(rootFo, f.first())) { depCtx.newBinariesToScan.add(root); break; } @@ -4020,12 +4021,12 @@ FileObject rootFo = URLCache.getInstance().findFileObject(root, true); if (rootFo != null) { for(Pair f : suspects) { - if (f.first == rootFo || FileUtil.isParentOf(f.first, rootFo)) { + if (f.first() == rootFo || FileUtil.isParentOf(f.first(), rootFo)) { Pair pair = sourceRootsToScan.get(root); if (pair == null) { - pair = Pair.of(rootFo, f.second); + pair = Pair.of(rootFo, f.second()); } else { - pair = Pair.of(rootFo, pair.second || f.second); + pair = Pair.of(rootFo, pair.second() || f.second()); } sourceRootsToScan.put(root, pair); containers.add(f); @@ -4039,7 +4040,7 @@ for(Iterator> it = suspects.iterator(); it.hasNext(); ) { Pair f = it.next(); Pair root = entry.getValue(); - if (FileUtil.isParentOf(root.first, f.first) && (root.second || !f.second)) { // second means fullRescan + if (FileUtil.isParentOf(root.first(), f.first()) && (root.second() || !f.second())) { // second means fullRescan it.remove(); } } @@ -4047,7 +4048,7 @@ for(Map.Entry> entry : sourceRootsToScan.entrySet()) { depCtx.newRootsToScan.add(entry.getKey()); - if (entry.getValue().second) { + if (entry.getValue().second()) { depCtx.fullRescanSourceRoots.add(entry.getKey()); } } @@ -4060,14 +4061,14 @@ for(Pair f : suspects) { for(URL root : scannedRoots2Dependencies.keySet()) { FileObject rootFo = URLCache.getInstance().findFileObject(root, true); - if (rootFo != null && (f.first == rootFo || FileUtil.isParentOf(rootFo, f.first))) { - Map> map = f.second ? fullRescanFiles : checkTimestampFiles; + if (rootFo != null && (f.first() == rootFo || FileUtil.isParentOf(rootFo, f.first()))) { + Map> map = f.second() ? fullRescanFiles : checkTimestampFiles; Set files = map.get(root); if (files == null) { files = new HashSet(); map.put(root, files); } - files.add(f.first); + files.add(f.first()); break; } } @@ -4631,7 +4632,7 @@ final long binaryScanStart = System.currentTimeMillis(); final Pair> res = pool.execute(); final long binaryScanEnd = System.currentTimeMillis(); - ctx.scannedBinaries.addAll(res.second); + ctx.scannedBinaries.addAll(res.second()); if (LOGGER.isLoggable(Level.INFO)) { LOGGER.log( Level.INFO, @@ -4642,7 +4643,7 @@ }); } TEST_LOGGER.log(Level.FINEST, "scanBinary", ctx.newBinariesToScan); //NOI18N - return res.first; + return res.first(); } protected final boolean scanBinary(URL root, BinaryIndexers binaryIndexers, AtomicInteger scannedRootsCnt) { @@ -4664,7 +4665,7 @@ final Pair,Integer>> lastState = ArchiveTimeStamps.getLastModified(file.getURL()); final boolean indexersUpToDate = checkBinaryIndexers(lastState, contexts); currentLastModified = file.lastModified().getTime(); - upToDate = indexersUpToDate && lastState.first == currentLastModified; + upToDate = indexersUpToDate && lastState.first() == currentLastModified; } else { currentLastModified = -1L; upToDate = false; @@ -4926,7 +4927,7 @@ final Pair indexerKey = Pair.of(factory.getIndexerName(),factory.getIndexVersion()); final Pair ctx = transactionContexts.get(indexerKey); if (ctx != null) { - SPIAccessor.getInstance().index(indexer, Collections.emptySet(), ctx.second); + SPIAccessor.getInstance().index(indexer, Collections.emptySet(), ctx.second()); } else { LOGGER.log( Level.WARNING, "RefreshCifIndices ignored recently added factory: {0}", //NOI18N @@ -5870,10 +5871,10 @@ } sourceRoots.clear(); for(Map.Entry> entry : binaryRoots.entrySet()) { - if (entry.getValue().second) { - safeRemoveFileChangeListener(this.binariesListener, entry.getValue().first); + if (entry.getValue().second()) { + safeRemoveFileChangeListener(this.binariesListener, entry.getValue().first()); } else { - safeRemoveRecursiveListener(this.binariesListener, entry.getValue().first); + safeRemoveRecursiveListener(this.binariesListener, entry.getValue().first()); } } binaryRoots.clear(); @@ -5949,10 +5950,10 @@ if (binariesListener != null) { Pair pair = binaryRoots.remove(root); if (pair != null) { - if (pair.second) { - safeRemoveFileChangeListener(binariesListener, pair.first); + if (pair.second()) { + safeRemoveFileChangeListener(binariesListener, pair.first()); } else { - safeRemoveRecursiveListener(binariesListener, pair.first); + safeRemoveRecursiveListener(binariesListener, pair.first()); } } } diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/VisibilitySupport.java b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/VisibilitySupport.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/VisibilitySupport.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/VisibilitySupport.java @@ -69,6 +69,7 @@ import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.RequestProcessor; @@ -229,21 +230,21 @@ if (owner != null) { final boolean visible = vq.isVisible(chf); try { - final URI ownerURI = owner.first.toURI(); + final URI ownerURI = owner.first().toURI(); if (visible) { Collection files = srcShownPerRoot.get(ownerURI); if (files == null) { files = new ArrayList(); srcShownPerRoot.put(ownerURI, files); } - if (chf.equals(owner.second)) { + if (chf.equals(owner.second())) { for (FileObject cld : chf.getChildren()) { files.add(cld.toURL()); } } else { files.add(chf.toURL()); } - } else if (owner.second != null) { + } else if (owner.second() != null) { Set files = srcHiddenPerRoot.get(ownerURI); if (files == null) { files = new HashSet(); @@ -252,12 +253,12 @@ if (chf.isFolder()) { TimeStamps ts = tsPerRoot.get(ownerURI); if (ts == null) { - ts = TimeStamps.forRoot(owner.first, false); + ts = TimeStamps.forRoot(owner.first(), false); tsPerRoot.put(ownerURI, ts); } - files.addAll(ts.getEnclosedFiles(FileUtil.getRelativePath(owner.second, chf))); + files.addAll(ts.getEnclosedFiles(FileUtil.getRelativePath(owner.second(), chf))); } else { - files.add(FileUtil.getRelativePath(owner.second, chf)); + files.add(FileUtil.getRelativePath(owner.second(), chf)); } } } catch (URISyntaxException e) { @@ -270,7 +271,7 @@ owner = ru.getOwningBinaryRoot(chf); if (owner != null) { try { - final URI ownerURI = owner.first.toURI(); + final URI ownerURI = owner.first().toURI(); binChangedRoot.add(ownerURI); } catch (URISyntaxException e) { Exceptions.printStackTrace(e); diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/lucene/DocumentBasedIndexManager.java b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/lucene/DocumentBasedIndexManager.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/lucene/DocumentBasedIndexManager.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/lucene/DocumentBasedIndexManager.java @@ -51,12 +51,12 @@ import org.netbeans.api.annotations.common.CheckForNull; import org.netbeans.api.annotations.common.NonNull; import org.netbeans.modules.parsing.impl.indexing.ClusteredIndexables; -import org.netbeans.modules.parsing.impl.indexing.Pair; import org.netbeans.modules.parsing.impl.indexing.PathRegistry; import org.netbeans.modules.parsing.lucene.support.DocumentIndex; import org.netbeans.modules.parsing.lucene.support.DocumentIndexCache; import org.netbeans.modules.parsing.lucene.support.IndexManager; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.Utilities; @@ -136,21 +136,21 @@ throw new IOException(e); } } - return li == null ? null : li.first; + return li == null ? null : li.first(); } @CheckForNull public synchronized DocumentIndexCache getCache(@NonNull final URL root) { final Pair entry = indexes.get(root); - return entry == null ? null : entry.second; + return entry == null ? null : entry.second(); } @CheckForNull public synchronized DocumentIndex.Transactional getIndex(@NonNull final DocumentIndexCache cache) { Parameters.notNull("cache", cache); //NOI18N for (Pair e : indexes.values()) { - if (cache.equals(e.second)) { - return e.first; + if (cache.equals(e.second())) { + return e.first(); } } return null; @@ -163,7 +163,7 @@ closed = true; for (Pair index : indexes.values()) { try { - index.first.close(); + index.first().close(); } catch (IOException ioe) { Exceptions.printStackTrace(ioe); } diff --git a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/lucene/LayeredDocumentIndex.java b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/lucene/LayeredDocumentIndex.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/lucene/LayeredDocumentIndex.java +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/lucene/LayeredDocumentIndex.java @@ -50,7 +50,6 @@ import java.util.Set; import org.apache.lucene.analysis.KeywordAnalyzer; import org.netbeans.api.annotations.common.NonNull; -import org.netbeans.modules.parsing.impl.indexing.Pair; import org.netbeans.modules.parsing.lucene.support.DocumentIndex; import org.netbeans.modules.parsing.lucene.support.Index.Status; import org.netbeans.modules.parsing.lucene.support.IndexDocument; @@ -58,6 +57,7 @@ import org.netbeans.modules.parsing.lucene.support.Queries.QueryKind; import org.openide.util.Exceptions; import static org.netbeans.modules.parsing.impl.indexing.TransientUpdateSupport.isTransientUpdate; +import org.openide.util.Pair; /** * * @author Tomas Zezula @@ -118,8 +118,8 @@ public void store(boolean optimize) throws IOException { if (isTransientUpdate()) { final Pair> ovl = getOverlayIfExists(); - if (ovl.first != null) { - ovl.first.store(false); + if (ovl.first() != null) { + ovl.first().store(false); } } else { base.store(optimize); @@ -167,12 +167,12 @@ public Collection query(String fieldName, String value, QueryKind kind, String... fieldsToLoad) throws IOException, InterruptedException { final Collection br = base.query(fieldName, value, kind, fieldsToLoad); final Pair> ovl = getOverlayIfExists(); - if (ovl.first == null) { - return ovl.second == null ? br : filter(br,ovl.second); + if (ovl.first() == null) { + return ovl.second() == null ? br : filter(br,ovl.second()); } else { return new ProxyCollection( - ovl.second == null ? br : filter(br,ovl.second), - ovl.first.query(fieldName, value, kind, fieldsToLoad)); + ovl.second() == null ? br : filter(br,ovl.second()), + ovl.first().query(fieldName, value, kind, fieldsToLoad)); } } @@ -180,12 +180,12 @@ public Collection findByPrimaryKey(String primaryKeyValue, QueryKind kind, String... fieldsToLoad) throws IOException, InterruptedException { final Collection br = base.findByPrimaryKey(primaryKeyValue, kind, fieldsToLoad); final Pair> ovl = getOverlayIfExists(); - if (ovl.first == null) { - return ovl.second == null ? br : filter(br, ovl.second); + if (ovl.first() == null) { + return ovl.second() == null ? br : filter(br, ovl.second()); } else { return new ProxyCollection( - ovl.second == null ? br : filter(br,ovl.second), - ovl.first.findByPrimaryKey(primaryKeyValue, kind, fieldsToLoad)); + ovl.second() == null ? br : filter(br,ovl.second()), + ovl.first().findByPrimaryKey(primaryKeyValue, kind, fieldsToLoad)); } } diff --git a/parsing.api/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupport.java b/parsing.api/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupport.java --- a/parsing.api/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupport.java +++ b/parsing.api/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupport.java @@ -72,7 +72,6 @@ import org.netbeans.modules.parsing.impl.Utilities; import org.netbeans.modules.parsing.impl.indexing.CacheFolder; import org.netbeans.modules.parsing.impl.indexing.IndexFactoryImpl; -import org.netbeans.modules.parsing.impl.indexing.Pair; import org.netbeans.modules.parsing.impl.indexing.PathRecognizerRegistry; import org.netbeans.modules.parsing.impl.indexing.PathRegistry; import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater; @@ -89,6 +88,7 @@ import org.openide.filesystems.FileObject; import org.openide.filesystems.FileStateInvalidException; import org.openide.filesystems.URLMapper; +import org.openide.util.Pair; import org.openide.util.Parameters; /** @@ -327,7 +327,7 @@ Iterable> indices = indexerQuery.getIndices(roots); // check if there are stale indices for (Pair pair : indices) { - final LayeredDocumentIndex index = pair.second; + final LayeredDocumentIndex index = pair.second(); final Collection staleFiles = index.getDirtyKeys(); final boolean scanningThread = RunWhenScanFinishedSupport.isScanningThread(); LOG.log( @@ -339,7 +339,7 @@ scanningThread }); if (!staleFiles.isEmpty() && !scanningThread) { - final URL root = pair.first; + final URL root = pair.first(); LinkedList list = new LinkedList(); for (String staleFile : staleFiles) { try { @@ -358,8 +358,8 @@ } final List result = new LinkedList(); for (Pair pair : indices) { - final DocumentIndex index = pair.second; - final URL root = pair.first; + final DocumentIndex index = pair.second(); + final URL root = pair.first(); final Collection pr = index.query( fieldName, fieldValue, @@ -450,7 +450,7 @@ LOG.fine(getClass().getSimpleName() + "@" + Integer.toHexString(System.identityHashCode(this)) //NOI18N + "[indexer=" + indexerQuery.getIndexerId() + "]:"); //NOI18N for(Pair pair : indexerQuery.getIndices(this.roots)) { - LOG.fine(" " + pair.first + " -> index: " + pair.second); //NOI18N + LOG.fine(" " + pair.first() + " -> index: " + pair.second()); //NOI18N } LOG.fine("----"); //NOI18N } diff --git a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/RunWhenScanFinishedSupportTest.java b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/RunWhenScanFinishedSupportTest.java --- a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/RunWhenScanFinishedSupportTest.java +++ b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/RunWhenScanFinishedSupportTest.java @@ -57,13 +57,13 @@ import org.netbeans.api.annotations.common.NonNull; import org.netbeans.junit.NbTestCase; import org.netbeans.modules.parsing.api.Source; -import org.netbeans.modules.parsing.impl.indexing.Pair; import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.IndexingState; import org.netbeans.modules.parsing.spi.ParseException; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.util.Exceptions; import org.openide.util.Mutex; +import org.openide.util.Pair; /** * @@ -281,10 +281,10 @@ final Object param = record.getParameters()[0]; for (Iterator, CountDownLatch>> it = condition.iterator(); it.hasNext();) { final Pair,CountDownLatch> cnd = it.next(); - if (cnd != null && cnd.first.first.equals(message) && cnd.first.second.equals(param)) { + if (cnd != null && cnd.first().first().equals(message) && cnd.first().second().equals(param)) { //System.out.println("GOT: " + cnd.first.first + " " + cnd.first.second); it.remove(); - cnd.second.countDown(); + cnd.second().countDown(); break; } } diff --git a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/TaskProcessorTest.java b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/TaskProcessorTest.java --- a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/TaskProcessorTest.java +++ b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/TaskProcessorTest.java @@ -86,7 +86,6 @@ import org.netbeans.modules.parsing.api.Task; import org.netbeans.modules.parsing.api.UserTask; import org.netbeans.modules.parsing.impl.event.EventSupport; -import org.netbeans.modules.parsing.impl.indexing.Pair; import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater; import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdaterTestSupport; import org.netbeans.modules.parsing.impl.indexing.Util; @@ -106,6 +105,7 @@ import org.openide.loaders.DataObject; import org.openide.text.NbDocument; import org.openide.util.Exceptions; +import org.openide.util.Pair; /** * @@ -229,7 +229,7 @@ start_b.countDown(); start_a.await(); SourceAccessor.getINSTANCE().getCache(src).invalidate(); - TaskProcessor.removePhaseCompletionTasks(Collections.singleton(tasks.iterator().next().first), src); + TaskProcessor.removePhaseCompletionTasks(Collections.singleton(tasks.iterator().next().first()), src); } end.countDown(); } diff --git a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ArchiveTimeStampsTest.java b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ArchiveTimeStampsTest.java --- a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ArchiveTimeStampsTest.java +++ b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ArchiveTimeStampsTest.java @@ -58,6 +58,7 @@ import org.netbeans.junit.NbTestCase; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; +import org.openide.util.Pair; import org.openide.util.Utilities; /** diff --git a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexablesCacheTest.java b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexablesCacheTest.java --- a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexablesCacheTest.java +++ b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexablesCacheTest.java @@ -89,6 +89,7 @@ import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.Parameters; /** @@ -484,12 +485,12 @@ @Override public Boolean convert(@NonNull final Pair p) { - if (!forIndexer.equals(p.second)) { + if (!forIndexer.equals(p.second())) { return null; } try { - final FileObject cacheFolder = CacheFolder.getDataFolder(p.first); - final FileObject indexer = cacheFolder.getFileObject(p.second); + final FileObject cacheFolder = CacheFolder.getDataFolder(p.first()); + final FileObject indexer = cacheFolder.getFileObject(p.second()); final FileObject indexFolder = indexer.getFileObject("1/1"); final DocumentIndexCache cache = DocumentBasedIndexManager.getDefault().getCache(indexFolder.toURL()); final Class c = Class.forName("org.netbeans.modules.parsing.impl.indexing.ClusteredIndexables$DocumentIndexCacheImpl"); //NOI18N diff --git a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/DocumentStoreTest.java b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/DocumentStoreTest.java --- a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/DocumentStoreTest.java +++ b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/DocumentStoreTest.java @@ -60,6 +60,7 @@ import org.netbeans.modules.parsing.lucene.support.Index; import org.netbeans.modules.parsing.lucene.support.IndexDocument; import org.netbeans.modules.parsing.lucene.support.IndexManager; +import org.openide.util.Pair; /** * @@ -204,9 +205,9 @@ createDefaultData(size); final long st = System.currentTimeMillis(); index.store( - p.first, + p.first(), Collections.emptySet(), - p.second, + p.second(), new Convertor() { @Override public Query convert(String p) { @@ -215,7 +216,7 @@ }, true); final long et = System.currentTimeMillis(); - System.out.println(p.first.getClass().getSimpleName() + " : " + (et-st)); + System.out.println(p.first().getClass().getSimpleName() + " : " + (et-st)); index.close(); } diff --git a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/FileObjectCrawlerTest.java b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/FileObjectCrawlerTest.java --- a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/FileObjectCrawlerTest.java +++ b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/FileObjectCrawlerTest.java @@ -68,6 +68,7 @@ import org.openide.filesystems.FileStateInvalidException; import org.openide.filesystems.FileSystem; import org.openide.filesystems.FileUtil; +import org.openide.util.Pair; /** * diff --git a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RefreshWorkTest.java b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RefreshWorkTest.java --- a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RefreshWorkTest.java +++ b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RefreshWorkTest.java @@ -63,6 +63,7 @@ import org.openide.filesystems.FileChangeAdapter; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; +import org.openide.util.Pair; import org.openide.util.Utilities; /** diff --git a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater2Test.java b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater2Test.java --- a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater2Test.java +++ b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater2Test.java @@ -95,6 +95,7 @@ import org.openide.filesystems.URLMapper; import org.openide.util.Exceptions; import org.openide.util.Lookup; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.RequestProcessor; import org.openide.util.test.MockLookup; @@ -882,9 +883,9 @@ ruSync.await(); assertEquals("Wrong number of roots", 1, indexer.indexed.size()); - assertEquals("Expecting nested root", nestedRoot.getURL(), indexer.indexed.get(0).first.getRootURI()); - assertEquals("Wrong number of files under nestedRoot", 1, indexer.indexed.get(0).second.size()); - assertEquals("Wring file indexed", file2.getURL(), indexer.indexed.get(0).second.get(0).getURL()); + assertEquals("Expecting nested root", nestedRoot.getURL(), indexer.indexed.get(0).first().getRootURI()); + assertEquals("Wrong number of files under nestedRoot", 1, indexer.indexed.get(0).second().size()); + assertEquals("Wring file indexed", file2.getURL(), indexer.indexed.get(0).second().get(0).getURL()); } public void testMarkingIndexesDirty() throws Exception { @@ -916,7 +917,7 @@ // the indexer does not store any data and so physically there is no lucene index on the disk // therefore we have to forcibly create one - Context ctx = indexer.indexed.get(0).first; + Context ctx = indexer.indexed.get(0).first(); DocumentIndex ii = SPIAccessor.getInstance().getIndexFactory(ctx).createIndex(ctx); ii.markKeyDirty("file1.txt"); // marks index as dirty and adds file1.txt among stale files assertEquals("Wrong number of stale files", 1, ii.getDirtyKeys().size()); @@ -928,9 +929,9 @@ ruSync.await(); assertEquals("Wrong number of roots", 1, indexer.indexed.size()); - assertEquals("Expecting root", root.getURL(), indexer.indexed.get(0).first.getRootURI()); - assertEquals("Wrong number of files under root", 1, indexer.indexed.get(0).second.size()); - assertEquals("Wrong file indexed", file1.getURL(), indexer.indexed.get(0).second.get(0).getURL()); + assertEquals("Expecting root", root.getURL(), indexer.indexed.get(0).first().getRootURI()); + assertEquals("Wrong number of files under root", 1, indexer.indexed.get(0).second().size()); + assertEquals("Wrong file indexed", file1.getURL(), indexer.indexed.get(0).second().get(0).getURL()); assertEquals("Expecting no stale files", 0, ii.getDirtyKeys().size()); } diff --git a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdaterTest.java b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdaterTest.java --- a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdaterTest.java +++ b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdaterTest.java @@ -150,6 +150,7 @@ import org.openide.util.ChangeSupport; import org.openide.util.Exceptions; import org.openide.util.Lookup; +import org.openide.util.Pair; import org.openide.util.RequestProcessor; /** @@ -1509,15 +1510,15 @@ assertEquals(1, contextState.size()); Pair state = contextState.get(this.srcRootWithFiles1.getURL()); assertNotNull(state); - assertTrue(state.first); - assertFalse(state.second); + assertTrue(state.first()); + assertFalse(state.second()); contextState = eindexerFactory.indexer.getContextState(); assertEquals(embeddedFiles.length, contextState.size()); for (URL url : embeddedFiles) { state = contextState.get(url); assertNotNull(state); - assertTrue(state.first); - assertFalse(state.second); + assertTrue(state.first()); + assertFalse(state.second()); } //2nd) Clean up - unregister @@ -1544,8 +1545,8 @@ assertEquals(1, contextState.size()); state = contextState.get(this.srcRootWithFiles1.getURL()); assertNotNull(state); - assertFalse(state.first); - assertFalse(state.second); + assertFalse(state.first()); + assertFalse(state.second()); contextState = eindexerFactory.indexer.getContextState(); assertEquals(0, contextState.size()); @@ -1576,14 +1577,14 @@ assertEquals(1, contextState.size()); state = contextState.get(this.srcRootWithFiles1.getURL()); assertNotNull(state); - assertFalse(state.first); - assertFalse(state.second); + assertFalse(state.first()); + assertFalse(state.second()); contextState = eindexerFactory.indexer.getContextState(); assertEquals(1, contextState.size()); state = contextState.get(embeddedFiles[0]); assertNotNull(state); - assertFalse(state.first); - assertFalse(state.second); + assertFalse(state.first()); + assertFalse(state.second()); //6th Do some modification when source are registered (allFiles should be false) indexerFactory.indexer.setExpectedFile(new URL[] {customFiles[0]}, new URL[0], new URL[0]); @@ -1597,14 +1598,14 @@ assertEquals(1, contextState.size()); state = contextState.get(this.srcRootWithFiles1.getURL()); assertNotNull(state); - assertFalse(state.first); - assertFalse(state.second); + assertFalse(state.first()); + assertFalse(state.second()); contextState = eindexerFactory.indexer.getContextState(); assertEquals(1, contextState.size()); state = contextState.get(embeddedFiles[0]); assertNotNull(state); - assertFalse(state.first); - assertFalse(state.second); + assertFalse(state.first()); + assertFalse(state.second()); //7th IndexingManager.refreshIndex(root, all_files, fullRescan==true) (allFiles should be true) indexerFactory.indexer.setExpectedFile(customFiles, new URL[0], new URL[0]); @@ -1616,15 +1617,15 @@ assertEquals(1, contextState.size()); state = contextState.get(this.srcRootWithFiles1.getURL()); assertNotNull(state); - assertTrue(state.first); - assertFalse(state.second); + assertTrue(state.first()); + assertFalse(state.second()); contextState = eindexerFactory.indexer.getContextState(); assertEquals(embeddedFiles.length, contextState.size()); for (URL url : embeddedFiles) { state = contextState.get(url); assertNotNull(state); - assertTrue(state.first); - assertFalse(state.second); + assertTrue(state.first()); + assertFalse(state.second()); } //8th IndexingManager.refreshIndex(root, specifoc_file, fullRescan==true, checkEditor==true) (allFiles should be false, checkForEditorModifications should be true) @@ -1637,14 +1638,14 @@ assertEquals(1, contextState.size()); state = contextState.get(this.srcRootWithFiles1.getURL()); assertNotNull(state); - assertFalse(state.first); - assertTrue(state.second); + assertFalse(state.first()); + assertTrue(state.second()); contextState = eindexerFactory.indexer.getContextState(); assertEquals(1, contextState.size()); state = contextState.get(embeddedFiles[0]); assertNotNull(state); - assertFalse(state.first); - assertTrue(state.second); + assertFalse(state.first()); + assertTrue(state.second()); } public void testVisibilityQueryAmongIDERestarts() throws Exception { diff --git a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ScanStartedTest.java b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ScanStartedTest.java --- a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ScanStartedTest.java +++ b/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ScanStartedTest.java @@ -70,6 +70,7 @@ import org.netbeans.spi.java.classpath.support.ClassPathSupport; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; +import org.openide.util.Pair; /** * @@ -534,8 +535,8 @@ if (ie != null && msg != null && msg.startsWith("scanStarting:") && //NOI18N - ie.first.equals(record.getParameters()[0])) { - throw ie.second; + ie.first().equals(record.getParameters()[0])) { + throw ie.second(); } else { super.publish(record); } diff --git a/parsing.api/test/unit/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupportTest.java b/parsing.api/test/unit/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupportTest.java --- a/parsing.api/test/unit/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupportTest.java +++ b/parsing.api/test/unit/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupportTest.java @@ -59,7 +59,6 @@ import org.netbeans.api.java.queries.SourceForBinaryQuery; import org.netbeans.junit.MockServices; import org.netbeans.junit.NbTestCase; -import org.netbeans.modules.parsing.impl.indexing.Pair; import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater; import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdaterTest; import org.netbeans.modules.parsing.impl.indexing.friendapi.IndexingController; @@ -70,6 +69,7 @@ import org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation2; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; +import org.openide.util.Pair; /** * @@ -584,12 +584,12 @@ return new Result() { @Override public boolean preferSources() { - return sources.first; + return sources.first(); } @Override public FileObject[] getRoots() { - return sources.second.toArray(new FileObject[sources.second.size()]); + return sources.second().toArray(new FileObject[sources.second().size()]); } @Override diff --git a/php.api.editor/manifest.mf b/php.api.editor/manifest.mf --- a/php.api.editor/manifest.mf +++ b/php.api.editor/manifest.mf @@ -1,4 +1,4 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.php.api.editor/0 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/api/editor/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 0.11 +OpenIDE-Module-Specification-Version: 0.12 diff --git a/php.api.editor/nbproject/project.xml b/php.api.editor/nbproject/project.xml --- a/php.api.editor/nbproject/project.xml +++ b/php.api.editor/nbproject/project.xml @@ -19,7 +19,7 @@ - 2.0 + 2.19 @@ -35,7 +35,7 @@ - 8.26 + 8.32 diff --git a/php.api.editor/src/org/netbeans/modules/php/api/editor/EditorSupport.java b/php.api.editor/src/org/netbeans/modules/php/api/editor/EditorSupport.java --- a/php.api.editor/src/org/netbeans/modules/php/api/editor/EditorSupport.java +++ b/php.api.editor/src/org/netbeans/modules/php/api/editor/EditorSupport.java @@ -43,8 +43,8 @@ package org.netbeans.modules.php.api.editor; import java.util.Collection; -import org.netbeans.modules.php.api.util.Pair; import org.openide.filesystems.FileObject; +import org.openide.util.Pair; /** * Helper editor class that can be found in the default lookup. diff --git a/php.api.executable/manifest.mf b/php.api.executable/manifest.mf --- a/php.api.executable/manifest.mf +++ b/php.api.executable/manifest.mf @@ -1,4 +1,4 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.php.api.executable/0 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/api/executable/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 0.13 +OpenIDE-Module-Specification-Version: 0.14 diff --git a/php.api.executable/nbproject/project.xml b/php.api.executable/nbproject/project.xml --- a/php.api.executable/nbproject/project.xml +++ b/php.api.executable/nbproject/project.xml @@ -37,7 +37,7 @@ - 2.0 + 2.19 @@ -87,7 +87,7 @@ - 8.26 + 8.32 diff --git a/php.api.executable/src/org/netbeans/modules/php/api/executable/PhpExecutable.java b/php.api.executable/src/org/netbeans/modules/php/api/executable/PhpExecutable.java --- a/php.api.executable/src/org/netbeans/modules/php/api/executable/PhpExecutable.java +++ b/php.api.executable/src/org/netbeans/modules/php/api/executable/PhpExecutable.java @@ -79,7 +79,6 @@ import org.netbeans.api.project.Project; import org.netbeans.api.queries.FileEncodingQuery; import org.netbeans.modules.php.api.phpmodule.PhpOptions; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.api.util.StringUtils; import org.netbeans.modules.php.api.util.UiUtils; import org.netbeans.modules.php.spi.executable.DebugStarter; @@ -89,6 +88,7 @@ import org.openide.util.Cancellable; import org.openide.util.Lookup; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.Utilities; import org.openide.windows.InputOutput; @@ -162,8 +162,8 @@ */ public PhpExecutable(String command) { Pair> parsedCommand = parseCommand(command); - executable = parsedCommand.first; - parameters = parsedCommand.second; + executable = parsedCommand.first(); + parameters = parsedCommand.second(); this.command = command.trim(); } @@ -179,7 +179,7 @@ return Pair.of(tokens[0].trim(), Collections.emptyList()); } Pair> parsedCommand = Pair.of(tokens[0].trim(), Arrays.asList(Utilities.parseParameters(tokens[1].trim()))); - LOGGER.log(Level.FINE, "Parameters parsed: {0} {1}", new Object[] {parsedCommand.first, parsedCommand.second}); + LOGGER.log(Level.FINE, "Parameters parsed: {0} {1}", new Object[] {parsedCommand.first(), parsedCommand.second()}); return parsedCommand; } diff --git a/php.api.executable/src/org/netbeans/modules/php/api/executable/PhpExecutableValidator.java b/php.api.executable/src/org/netbeans/modules/php/api/executable/PhpExecutableValidator.java --- a/php.api.executable/src/org/netbeans/modules/php/api/executable/PhpExecutableValidator.java +++ b/php.api.executable/src/org/netbeans/modules/php/api/executable/PhpExecutableValidator.java @@ -71,7 +71,7 @@ public static String validateCommand(@NullAllowed String command, @NullAllowed String executableName) { String executable = null; if (command != null) { - executable = PhpExecutable.parseCommand(command).first; + executable = PhpExecutable.parseCommand(command).first(); } if (executableName == null) { return FileUtils.validateFile(executable, false); @@ -86,7 +86,7 @@ * @return error if it is not valid, {@code null} otherwise */ public static String validateCommand(@NonNull String command, @NonNull ValidationHandler validationHandler) { - return validationHandler.validate(PhpExecutable.parseCommand(command).first); + return validationHandler.validate(PhpExecutable.parseCommand(command).first()); } //~ Inner classes diff --git a/php.api.executable/src/org/netbeans/modules/php/spi/executable/DebugStarter.java b/php.api.executable/src/org/netbeans/modules/php/spi/executable/DebugStarter.java --- a/php.api.executable/src/org/netbeans/modules/php/spi/executable/DebugStarter.java +++ b/php.api.executable/src/org/netbeans/modules/php/spi/executable/DebugStarter.java @@ -50,9 +50,9 @@ import org.netbeans.api.annotations.common.NonNull; import org.netbeans.api.annotations.common.NullAllowed; import org.netbeans.api.project.Project; -import org.netbeans.modules.php.api.util.Pair; import org.openide.filesystems.FileObject; import org.openide.util.Cancellable; +import org.openide.util.Pair; import org.openide.util.Parameters; /** diff --git a/php.api.executable/test/unit/src/org/netbeans/modules/php/api/executable/PhpExecutableTest.java b/php.api.executable/test/unit/src/org/netbeans/modules/php/api/executable/PhpExecutableTest.java --- a/php.api.executable/test/unit/src/org/netbeans/modules/php/api/executable/PhpExecutableTest.java +++ b/php.api.executable/test/unit/src/org/netbeans/modules/php/api/executable/PhpExecutableTest.java @@ -45,7 +45,7 @@ import java.util.List; import org.junit.Test; import org.netbeans.junit.NbTestCase; -import org.netbeans.modules.php.api.util.Pair; +import org.openide.util.Pair; public class PhpExecutableTest extends NbTestCase { @@ -56,56 +56,56 @@ @Test public void testParseNullCommand() { Pair> command = PhpExecutable.parseCommand(null); - assertEquals("", command.first); - assertTrue(command.second.isEmpty()); + assertEquals("", command.first()); + assertTrue(command.second().isEmpty()); } @Test public void testParseEmptyCommand() { Pair> command = PhpExecutable.parseCommand(""); - assertEquals("", command.first); - assertTrue(command.second.isEmpty()); + assertEquals("", command.first()); + assertTrue(command.second().isEmpty()); } @Test public void testParseOnlyCommand() { Pair> command = PhpExecutable.parseCommand("/usr/bin/php"); - assertEquals("/usr/bin/php", command.first); - assertTrue(command.second.isEmpty()); + assertEquals("/usr/bin/php", command.first()); + assertTrue(command.second().isEmpty()); } @Test public void testParseCommandWithParam1() { Pair> command = PhpExecutable.parseCommand("/usr/bin/php --verbose"); - assertEquals("/usr/bin/php", command.first); - assertEquals(1, command.second.size()); - assertEquals("--verbose", command.second.get(0)); + assertEquals("/usr/bin/php", command.first()); + assertEquals(1, command.second().size()); + assertEquals("--verbose", command.second().get(0)); } @Test public void testParseCommandWithParam2() { Pair> command = PhpExecutable.parseCommand("/usr/bin/php /verbose"); - assertEquals("/usr/bin/php", command.first); - assertEquals(1, command.second.size()); - assertEquals("/verbose", command.second.get(0)); + assertEquals("/usr/bin/php", command.first()); + assertEquals(1, command.second().size()); + assertEquals("/verbose", command.second().get(0)); } @Test public void testParseCommandWithParams1() { Pair> command = PhpExecutable.parseCommand("/usr/bin/php --verbose --version"); - assertEquals("/usr/bin/php", command.first); - assertEquals(2, command.second.size()); - assertEquals("--verbose", command.second.get(0)); - assertEquals("--version", command.second.get(1)); + assertEquals("/usr/bin/php", command.first()); + assertEquals(2, command.second().size()); + assertEquals("--verbose", command.second().get(0)); + assertEquals("--version", command.second().get(1)); } @Test public void testParseCommandWithParams2() { Pair> command = PhpExecutable.parseCommand("/usr/bin/php /verbose /version"); - assertEquals("/usr/bin/php", command.first); - assertEquals(2, command.second.size()); - assertEquals("/verbose", command.second.get(0)); - assertEquals("/version", command.second.get(1)); + assertEquals("/usr/bin/php", command.first()); + assertEquals(2, command.second().size()); + assertEquals("/verbose", command.second().get(0)); + assertEquals("/version", command.second().get(1)); } public void testInfoCommand() { diff --git a/php.api.phpmodule/manifest.mf b/php.api.phpmodule/manifest.mf --- a/php.api.phpmodule/manifest.mf +++ b/php.api.phpmodule/manifest.mf @@ -1,4 +1,4 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.php.api.phpmodule OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/api/phpmodule/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 2.18 +OpenIDE-Module-Specification-Version: 2.19 diff --git a/php.api.phpmodule/nbproject/project.xml b/php.api.phpmodule/nbproject/project.xml --- a/php.api.phpmodule/nbproject/project.xml +++ b/php.api.phpmodule/nbproject/project.xml @@ -104,7 +104,7 @@ - 8.26 + 8.32 diff --git a/php.api.phpmodule/src/org/netbeans/modules/php/api/util/Pair.java b/php.api.phpmodule/src/org/netbeans/modules/php/api/util/Pair.java deleted file mode 100644 --- a/php.api.phpmodule/src/org/netbeans/modules/php/api/util/Pair.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - * - * Contributor(s): - * - * Portions Copyrighted 2008 Sun Microsystems, Inc. - */ -package org.netbeans.modules.php.api.util; - -/** - * Class representing a pair of values. - */ -public final class Pair { - - public final P first; - public final K second; - - private Pair(P first, K second) { - this.first = first; - this.second = second; - } - - public static Pair of(P first, K second) { - return new Pair(first, second); - } - - @Override - public int hashCode() { - int hashCode = 0; - hashCode ^= first == null ? 0 : first.hashCode(); - hashCode ^= second == null ? 0 : second.hashCode(); - return hashCode; - } - - @Override - public boolean equals(final Object other) { - if (other instanceof Pair) { - Pair otherPair = (Pair) other; - return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) - && (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second)); - } - return false; - } - - @Override - public String toString() { - return String.format("Pair [%s, %s]", first, second); // NOI18N - } -} diff --git a/php.dbgp/manifest.mf b/php.dbgp/manifest.mf --- a/php.dbgp/manifest.mf +++ b/php.dbgp/manifest.mf @@ -3,5 +3,5 @@ OpenIDE-Module: org.netbeans.modules.php.dbgp OpenIDE-Module-Layer: org/netbeans/modules/php/dbgp/resources/layer.xml OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/dbgp/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 1.29 +OpenIDE-Module-Specification-Version: 1.30 diff --git a/php.dbgp/nbproject/project.xml b/php.dbgp/nbproject/project.xml --- a/php.dbgp/nbproject/project.xml +++ b/php.dbgp/nbproject/project.xml @@ -74,7 +74,7 @@ 0 - 0.10 + 0.14 @@ -82,7 +82,7 @@ - 2.0 + 2.19 @@ -189,7 +189,7 @@ - 8.0 + 8.32 diff --git a/php.dbgp/src/org/netbeans/modules/php/dbgp/DebuggerOptions.java b/php.dbgp/src/org/netbeans/modules/php/dbgp/DebuggerOptions.java --- a/php.dbgp/src/org/netbeans/modules/php/dbgp/DebuggerOptions.java +++ b/php.dbgp/src/org/netbeans/modules/php/dbgp/DebuggerOptions.java @@ -42,8 +42,8 @@ package org.netbeans.modules.php.dbgp; import java.util.List; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.project.api.PhpOptions; +import org.openide.util.Pair; /** * @author Radek Matous diff --git a/php.dbgp/src/org/netbeans/modules/php/dbgp/ProxyClient.java b/php.dbgp/src/org/netbeans/modules/php/dbgp/ProxyClient.java --- a/php.dbgp/src/org/netbeans/modules/php/dbgp/ProxyClient.java +++ b/php.dbgp/src/org/netbeans/modules/php/dbgp/ProxyClient.java @@ -71,11 +71,11 @@ private ProxyClient(DebuggerOptions options) { assert options != null; - assert options.getDebugProxy().first != null; - assert options.getDebugProxy().second != null; + assert options.getDebugProxy().first() != null; + assert options.getDebugProxy().second() != null; - this.proxyHost = options.getDebugProxy().first; - this.proxyPort = options.getDebugProxy().second; + this.proxyHost = options.getDebugProxy().first(); + this.proxyPort = options.getDebugProxy().second(); this.idePort = PhpOptions.getInstance().getDebuggerPort(); this.ideKey = PhpOptions.getInstance().getDebuggerSessionId(); } diff --git a/php.dbgp/src/org/netbeans/modules/php/dbgp/SessionId.java b/php.dbgp/src/org/netbeans/modules/php/dbgp/SessionId.java --- a/php.dbgp/src/org/netbeans/modules/php/dbgp/SessionId.java +++ b/php.dbgp/src/org/netbeans/modules/php/dbgp/SessionId.java @@ -53,10 +53,10 @@ import org.netbeans.api.project.ProjectUtils; import org.netbeans.api.project.SourceGroup; import org.netbeans.api.project.Sources; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.project.api.PhpOptions; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; +import org.openide.util.Pair; /** diff --git a/php.dbgp/src/org/netbeans/modules/php/dbgp/URIMapper.java b/php.dbgp/src/org/netbeans/modules/php/dbgp/URIMapper.java --- a/php.dbgp/src/org/netbeans/modules/php/dbgp/URIMapper.java +++ b/php.dbgp/src/org/netbeans/modules/php/dbgp/URIMapper.java @@ -55,10 +55,10 @@ import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; -import org.netbeans.modules.php.api.util.Pair; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.Utilities; /** @@ -86,8 +86,8 @@ for (Pair pair : pathMapping) { //1. mapper provided by user via project UI if any pair = encodedPathMappingPair(pair); - String uriPath = pair.first; - String filePath = pair.second; + String uriPath = pair.first(); + String filePath = pair.second(); if (uriPath.length() > 0 && filePath.length() > 0) { if (!uriPath.startsWith("file:")) {//NOI18N if (!uriPath.startsWith("/")) { @@ -368,7 +368,7 @@ } private static Pair encodedPathMappingPair(Pair pathMapping) { - String resName = pathMapping.first; + String resName = pathMapping.first(); resName = resName.replace('\\', '/');//NOI18N final String[] elements = resName.split("/"); // NOI18N final StringBuilder sb = new StringBuilder(200); @@ -391,7 +391,7 @@ sb.append('/'); } } - return Pair.of(sb.toString(), pathMapping.second);//NOI18N + return Pair.of(sb.toString(), pathMapping.second());//NOI18N } } diff --git a/php.dbgp/test/unit/src/org/netbeans/modules/php/dbgp/URIMapperTest.java b/php.dbgp/test/unit/src/org/netbeans/modules/php/dbgp/URIMapperTest.java --- a/php.dbgp/test/unit/src/org/netbeans/modules/php/dbgp/URIMapperTest.java +++ b/php.dbgp/test/unit/src/org/netbeans/modules/php/dbgp/URIMapperTest.java @@ -42,7 +42,6 @@ package org.netbeans.modules.php.dbgp; import java.util.LinkedList; -import org.netbeans.modules.php.api.util.Pair; import java.io.File; import java.io.IOException; import java.net.URI; @@ -52,6 +51,7 @@ import org.netbeans.junit.NbTestCase; import org.openide.filesystems.FileUtil; import static org.junit.Assert.*; +import org.openide.util.Pair; /** * @author Radek Matous diff --git a/php.editor/nbproject/project.properties b/php.editor/nbproject/project.properties --- a/php.editor/nbproject/project.properties +++ b/php.editor/nbproject/project.properties @@ -3,7 +3,7 @@ build.compiler=extJavac javac.compilerargs=-J-Xmx512m nbm.needs.restart=true -spec.version.base=1.36.0 +spec.version.base=1.37.0 release.external/predefined_vars.zip=docs/predefined_vars.zip sigtest.gen.fail.on.error=false diff --git a/php.editor/nbproject/project.xml b/php.editor/nbproject/project.xml --- a/php.editor/nbproject/project.xml +++ b/php.editor/nbproject/project.xml @@ -235,7 +235,7 @@ 0 - 0.1 + 0.12 @@ -243,7 +243,7 @@ - 2.14 + 2.19 @@ -351,7 +351,7 @@ - 8.0 + 8.32 diff --git a/php.editor/src/org/netbeans/modules/php/editor/model/impl/EditorSupportImpl.java b/php.editor/src/org/netbeans/modules/php/editor/model/impl/EditorSupportImpl.java --- a/php.editor/src/org/netbeans/modules/php/editor/model/impl/EditorSupportImpl.java +++ b/php.editor/src/org/netbeans/modules/php/editor/model/impl/EditorSupportImpl.java @@ -56,7 +56,6 @@ import org.netbeans.modules.php.api.editor.PhpBaseElement; import org.netbeans.modules.php.api.editor.PhpClass; import org.netbeans.modules.php.api.editor.PhpFunction; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.editor.api.ElementQuery.Index; import org.netbeans.modules.php.editor.api.ElementQueryFactory; import org.netbeans.modules.php.editor.api.NameKind; @@ -75,6 +74,7 @@ import org.netbeans.modules.php.editor.parser.PHPParseResult; import org.openide.filesystems.FileObject; import org.openide.util.Exceptions; +import org.openide.util.Pair; import org.openide.util.lookup.ServiceProvider; /** diff --git a/php.phpunit/manifest.mf b/php.phpunit/manifest.mf --- a/php.phpunit/manifest.mf +++ b/php.phpunit/manifest.mf @@ -3,5 +3,5 @@ OpenIDE-Module: org.netbeans.modules.php.phpunit/0 OpenIDE-Module-Layer: org/netbeans/modules/php/phpunit/resources/layer.xml OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/phpunit/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 0.5 +OpenIDE-Module-Specification-Version: 0.6 diff --git a/php.phpunit/nbproject/project.xml b/php.phpunit/nbproject/project.xml --- a/php.phpunit/nbproject/project.xml +++ b/php.phpunit/nbproject/project.xml @@ -56,7 +56,7 @@ 0 - 0.8 + 0.12 @@ -65,7 +65,7 @@ 0 - 0.10 + 0.14 @@ -73,7 +73,7 @@ - 2.12 + 2.19 @@ -173,7 +173,7 @@ - 8.30 + 8.32 diff --git a/php.phpunit/src/org/netbeans/modules/php/phpunit/locate/PhpUnitTestLocator.java b/php.phpunit/src/org/netbeans/modules/php/phpunit/locate/PhpUnitTestLocator.java --- a/php.phpunit/src/org/netbeans/modules/php/phpunit/locate/PhpUnitTestLocator.java +++ b/php.phpunit/src/org/netbeans/modules/php/phpunit/locate/PhpUnitTestLocator.java @@ -51,13 +51,13 @@ import org.netbeans.modules.php.api.editor.PhpClass; import org.netbeans.modules.php.api.phpmodule.PhpModule; import org.netbeans.modules.php.api.util.FileUtils; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.phpunit.commands.PhpUnit; import org.netbeans.modules.php.spi.testing.locate.Locations; import org.netbeans.modules.php.spi.testing.locate.TestLocator; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.util.Lookup; +import org.openide.util.Pair; public class PhpUnitTestLocator implements TestLocator { @@ -110,14 +110,14 @@ for (Pair namePair : classes) { // prefer FQN - Collection> files = editorSupport.filesForClass(sourceRoot, new PhpClass(namePair.first, namePair.second, -1)); + Collection> files = editorSupport.filesForClass(sourceRoot, new PhpClass(namePair.first(), namePair.second(), -1)); List results = filterPhpFiles(sourceRoot, files); if (!results.isEmpty()) { phpFiles.addAll(results); continue; } // #221816 - search only by class name - files = editorSupport.filesForClass(sourceRoot, new PhpClass(namePair.first, null, -1)); + files = editorSupport.filesForClass(sourceRoot, new PhpClass(namePair.first(), null, -1)); results = filterPhpFiles(sourceRoot, files); phpFiles.addAll(results); } @@ -128,10 +128,10 @@ private List filterPhpFiles(FileObject sourceRoot, Collection> files) { List results = new ArrayList(files.size()); for (Pair pair : files) { - FileObject fileObject = pair.first; + FileObject fileObject = pair.first(); if (FileUtils.isPhpFile(fileObject) && FileUtil.isParentOf(sourceRoot, fileObject)) { - results.add(new Locations.Offset(fileObject, pair.second)); + results.add(new Locations.Offset(fileObject, pair.second())); } } return results; diff --git a/php.project/manifest.mf b/php.project/manifest.mf --- a/php.project/manifest.mf +++ b/php.project/manifest.mf @@ -1,6 +1,6 @@ Manifest-Version: 1.0 AutoUpdate-Show-In-Client: false -OpenIDE-Module-Specification-Version: 2.81 +OpenIDE-Module-Specification-Version: 2.82 OpenIDE-Module: org.netbeans.modules.php.project OpenIDE-Module-Layer: org/netbeans/modules/php/project/resources/layer.xml OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/project/resources/Bundle.properties diff --git a/php.project/nbproject/project.xml b/php.project/nbproject/project.xml --- a/php.project/nbproject/project.xml +++ b/php.project/nbproject/project.xml @@ -258,7 +258,7 @@ 0 - 0.3 + 0.14 @@ -275,7 +275,7 @@ - 2.18 + 2.19 @@ -336,7 +336,7 @@ - 1.21 + 1.28 @@ -441,7 +441,7 @@ - 8.25 + 8.32 diff --git a/php.project/src/org/netbeans/modules/php/project/ProjectPropertiesSupport.java b/php.project/src/org/netbeans/modules/php/project/ProjectPropertiesSupport.java --- a/php.project/src/org/netbeans/modules/php/project/ProjectPropertiesSupport.java +++ b/php.project/src/org/netbeans/modules/php/project/ProjectPropertiesSupport.java @@ -52,7 +52,6 @@ import org.netbeans.api.progress.ProgressUtils; import org.netbeans.modules.php.api.executable.InvalidPhpExecutableException; import org.netbeans.modules.php.api.executable.PhpInterpreter; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.api.util.StringUtils; import org.netbeans.modules.php.project.api.PhpLanguageProperties; import org.netbeans.modules.php.project.api.PhpOptions; @@ -65,6 +64,7 @@ import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * Helper class for getting all the properties of a PHP project. diff --git a/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.java b/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.java --- a/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.java +++ b/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.java @@ -103,7 +103,6 @@ import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; import org.netbeans.api.annotations.common.StaticResource; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.project.PhpProject; import org.netbeans.modules.php.project.ProjectPropertiesSupport; import org.netbeans.modules.php.project.connections.RemoteClient; @@ -120,6 +119,7 @@ import org.openide.util.ImageUtilities; import org.openide.util.Mutex; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.RequestProcessor; /** @@ -822,7 +822,7 @@ if (!iterator.hasNext()) { selectionIsAdjusting = false; } - itemTable.getSelectionModel().addSelectionInterval(pair.first, pair.second); + itemTable.getSelectionModel().addSelectionInterval(pair.first(), pair.second()); } selectionIsAdjusting = false; } diff --git a/php.project/src/org/netbeans/modules/php/project/copysupport/LocalOperationFactory.java b/php.project/src/org/netbeans/modules/php/project/copysupport/LocalOperationFactory.java --- a/php.project/src/org/netbeans/modules/php/project/copysupport/LocalOperationFactory.java +++ b/php.project/src/org/netbeans/modules/php/project/copysupport/LocalOperationFactory.java @@ -50,13 +50,13 @@ import org.netbeans.modules.php.api.util.FileUtils; import org.netbeans.modules.php.project.PhpProject; import org.netbeans.modules.php.project.ProjectPropertiesSupport; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.project.ui.customizer.CompositePanelProviderImpl; import org.openide.filesystems.FileEvent; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileRenameEvent; import org.openide.filesystems.FileUtil; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @author Radek Matous @@ -304,8 +304,8 @@ return null; } - FileObject sourceRoot = cfgPair.first; - File targetRoot = cfgPair.second; + FileObject sourceRoot = cfgPair.first(); + File targetRoot = cfgPair.second(); assert sourceRoot != null; assert targetRoot != null; @@ -353,7 +353,7 @@ } private static boolean isPairValid(Pair pair) { - return pair != null && pair.first != null && pair.second != null; + return pair != null && pair.first() != null && pair.second() != null; } @Override diff --git a/php.project/src/org/netbeans/modules/php/project/ui/actions/support/CommandUtils.java b/php.project/src/org/netbeans/modules/php/project/ui/actions/support/CommandUtils.java --- a/php.project/src/org/netbeans/modules/php/project/ui/actions/support/CommandUtils.java +++ b/php.project/src/org/netbeans/modules/php/project/ui/actions/support/CommandUtils.java @@ -57,7 +57,6 @@ import java.util.logging.Logger; import org.netbeans.api.annotations.common.CheckForNull; import org.netbeans.modules.php.api.util.FileUtils; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.api.util.StringUtils; import org.netbeans.modules.php.project.PhpActionProvider; import org.netbeans.modules.php.project.PhpProject; @@ -75,6 +74,7 @@ import org.openide.util.Exceptions; import org.openide.util.Lookup; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.windows.TopComponent; /** diff --git a/php.project/src/org/netbeans/modules/php/project/ui/actions/support/ConfigActionTest.java b/php.project/src/org/netbeans/modules/php/project/ui/actions/support/ConfigActionTest.java --- a/php.project/src/org/netbeans/modules/php/project/ui/actions/support/ConfigActionTest.java +++ b/php.project/src/org/netbeans/modules/php/project/ui/actions/support/ConfigActionTest.java @@ -52,7 +52,6 @@ import org.netbeans.modules.gsf.testrunner.api.Testcase; import org.netbeans.modules.php.api.phpmodule.PhpModule; import org.netbeans.modules.php.api.util.FileUtils; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.project.PhpActionProvider; import org.netbeans.modules.php.project.PhpProject; import org.netbeans.modules.php.project.ProjectPropertiesSupport; @@ -66,6 +65,7 @@ import org.openide.filesystems.FileUtil; import org.openide.util.ChangeSupport; import org.openide.util.Lookup; +import org.openide.util.Pair; /** * Action implementation for TEST configuration. @@ -208,7 +208,7 @@ TestRunInfo testRunInfo = getTestRunInfoForFile(file, debug); assert testRunInfo != null; Pair method = CommandUtils.decodeMethod(singleMethod.getMethodName()); - TestRunInfo.TestInfo testInfo = new TestRunInfo.TestInfo(TestRunInfo.TestInfo.UNKNOWN_TYPE, method.second, method.first, + TestRunInfo.TestInfo testInfo = new TestRunInfo.TestInfo(TestRunInfo.TestInfo.UNKNOWN_TYPE, method.second(), method.first(), FileUtil.toFile(file).getAbsolutePath()); testRunInfo.setCustomTests(Collections.singleton(testInfo)); return testRunInfo; diff --git a/php.project/src/org/netbeans/modules/php/project/ui/actions/support/DebugScript.java b/php.project/src/org/netbeans/modules/php/project/ui/actions/support/DebugScript.java --- a/php.project/src/org/netbeans/modules/php/project/ui/actions/support/DebugScript.java +++ b/php.project/src/org/netbeans/modules/php/project/ui/actions/support/DebugScript.java @@ -36,7 +36,6 @@ import org.netbeans.api.extexecution.ExternalProcessBuilder; import org.netbeans.api.project.Project; import org.netbeans.api.queries.FileEncodingQuery; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.project.PhpProject; import org.netbeans.modules.php.project.ProjectPropertiesSupport; import org.netbeans.modules.php.spi.executable.DebugStarter; @@ -45,6 +44,7 @@ import org.openide.filesystems.FileObject; import org.openide.util.Cancellable; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @author Radek Matous, Tomas Mysik diff --git a/php.project/src/org/netbeans/modules/php/project/ui/actions/support/FileRunner.java b/php.project/src/org/netbeans/modules/php/project/ui/actions/support/FileRunner.java --- a/php.project/src/org/netbeans/modules/php/project/ui/actions/support/FileRunner.java +++ b/php.project/src/org/netbeans/modules/php/project/ui/actions/support/FileRunner.java @@ -62,7 +62,6 @@ import org.netbeans.api.queries.FileEncodingQuery; import org.netbeans.modules.php.api.executable.PhpExecutable; import org.netbeans.modules.php.api.executable.PhpInterpreter; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.api.util.StringUtils; import org.netbeans.modules.php.api.util.UiUtils; import org.netbeans.modules.php.project.PhpProject; @@ -76,6 +75,7 @@ import org.openide.util.Cancellable; import org.openide.util.Lookup; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.RequestProcessor; import org.openide.util.Utilities; import org.openide.windows.InputOutput; diff --git a/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsLocalWeb.java b/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsLocalWeb.java --- a/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsLocalWeb.java +++ b/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsLocalWeb.java @@ -60,13 +60,13 @@ import org.netbeans.modules.php.project.ProjectPropertiesSupport; import org.netbeans.modules.php.project.ui.Utils; import org.netbeans.modules.php.project.ui.customizer.PhpProjectProperties.RunAsType; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.project.PhpVisibilityQuery; import org.netbeans.modules.php.project.runconfigs.RunConfigLocal; import org.netbeans.modules.php.project.runconfigs.validation.RunConfigLocalValidator; import org.netbeans.spi.project.ui.support.ProjectCustomizer.Category; import org.openide.awt.Mnemonics; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @author Radek Matous, Tomas Mysik @@ -336,10 +336,10 @@ Pair pathMapping = advanced.getPathMapping(); Pair debugProxy = advanced.getDebugProxy(); RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_URL, advanced.getDebugUrl().name()); - RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_REMOTE, pathMapping.first); - RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_LOCAL, pathMapping.second); - RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_HOST, debugProxy.first); - RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_PORT, debugProxy.second); + RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_REMOTE, pathMapping.first()); + RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_LOCAL, pathMapping.second()); + RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_HOST, debugProxy.first()); + RunAsLocalWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_PORT, debugProxy.second()); } }//GEN-LAST:event_advancedButtonActionPerformed diff --git a/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsRemoteWeb.java b/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsRemoteWeb.java --- a/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsRemoteWeb.java +++ b/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsRemoteWeb.java @@ -70,7 +70,6 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.plaf.UIResource; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.project.PhpProject; import org.netbeans.modules.php.project.PhpVisibilityQuery; import org.netbeans.modules.php.project.ProjectPropertiesSupport; @@ -86,6 +85,7 @@ import org.netbeans.spi.project.ui.support.ProjectCustomizer.Category; import org.openide.awt.Mnemonics; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @author Tomas Mysik @@ -620,10 +620,10 @@ Pair pathMapping = advanced.getPathMapping(); Pair debugProxy = advanced.getDebugProxy(); RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_URL, advanced.getDebugUrl().name()); - RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_REMOTE, pathMapping.first); - RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_LOCAL, pathMapping.second); - RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_HOST, debugProxy.first); - RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_PORT, debugProxy.second); + RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_REMOTE, pathMapping.first()); + RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PATH_MAPPING_LOCAL, pathMapping.second()); + RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_HOST, debugProxy.first()); + RunAsRemoteWeb.this.putValue(PhpProjectProperties.DEBUG_PROXY_PORT, debugProxy.second()); } }//GEN-LAST:event_advancedButtonActionPerformed diff --git a/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsWebAdvanced.java b/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsWebAdvanced.java --- a/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsWebAdvanced.java +++ b/php.project/src/org/netbeans/modules/php/project/ui/customizer/RunAsWebAdvanced.java @@ -73,7 +73,6 @@ import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.api.util.StringUtils; import org.netbeans.modules.php.project.PhpProject; import org.netbeans.modules.php.project.ProjectPropertiesSupport; @@ -90,6 +89,7 @@ import org.openide.filesystems.FileUtil; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @author Tomas Mysik @@ -318,8 +318,8 @@ local = locals.get(i); } Pair pathMapping = getPathMapping(remotes.get(i), local); - paths[i][COLUMN_REMOTE_PATH] = pathMapping.first; - paths[i][COLUMN_LOCAL_PATH] = new LocalPathCell(pathMapping.second); + paths[i][COLUMN_REMOTE_PATH] = pathMapping.first(); + paths[i][COLUMN_LOCAL_PATH] = new LocalPathCell(pathMapping.second()); } paths[remotesSize][COLUMN_REMOTE_PATH] = null; paths[remotesSize][COLUMN_LOCAL_PATH] = new LocalPathCell(DEFAULT_LOCAL_PATH); diff --git a/php.project/src/org/netbeans/modules/php/project/ui/logicalview/ImportantFilesNodeFactory.java b/php.project/src/org/netbeans/modules/php/project/ui/logicalview/ImportantFilesNodeFactory.java --- a/php.project/src/org/netbeans/modules/php/project/ui/logicalview/ImportantFilesNodeFactory.java +++ b/php.project/src/org/netbeans/modules/php/project/ui/logicalview/ImportantFilesNodeFactory.java @@ -55,7 +55,6 @@ import javax.swing.event.ChangeListener; import org.netbeans.api.project.Project; import org.netbeans.modules.php.api.phpmodule.PhpModule; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.api.util.UiUtils; import org.netbeans.modules.php.project.PhpProject; import org.netbeans.modules.php.project.PhpVisibilityQuery; @@ -81,6 +80,7 @@ import org.openide.util.ChangeSupport; import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.RequestProcessor; /** @@ -309,18 +309,18 @@ private final FileObject sourceDir; public ImportantFileNode(Pair pair, FileObject sourceDir) throws DataObjectNotFoundException { - super(DataObject.find(pair.second).getNodeDelegate()); + super(DataObject.find(pair.second()).getNodeDelegate()); this.pair = pair; this.sourceDir = sourceDir; } @Override public String getShortDescription() { - String filepath = FileUtil.getRelativePath(sourceDir, pair.second); + String filepath = FileUtil.getRelativePath(sourceDir, pair.second()); if (filepath == null) { - filepath = FileUtil.getFileDisplayName(pair.second); + filepath = FileUtil.getFileDisplayName(pair.second()); } - return NbBundle.getMessage(ImportantFileNode.class, "LBL_ImportantFileTooltip", filepath, pair.first.getName()); + return NbBundle.getMessage(ImportantFileNode.class, "LBL_ImportantFileTooltip", filepath, pair.first().getName()); } } } diff --git a/php.project/src/org/netbeans/modules/php/project/util/PhpProjectUtils.java b/php.project/src/org/netbeans/modules/php/project/util/PhpProjectUtils.java --- a/php.project/src/org/netbeans/modules/php/project/util/PhpProjectUtils.java +++ b/php.project/src/org/netbeans/modules/php/project/util/PhpProjectUtils.java @@ -60,7 +60,6 @@ import org.netbeans.api.project.Sources; import org.netbeans.editor.BaseDocument; import org.netbeans.modules.editor.indent.api.Reformat; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.api.util.StringUtils; import org.netbeans.modules.php.project.PhpProject; import org.netbeans.modules.php.project.PhpSources; @@ -83,6 +82,7 @@ import org.openide.text.Line.Set; import org.openide.util.Mutex; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.UserQuestionException; /** diff --git a/php.project/test/unit/src/org/netbeans/modules/php/project/util/PhpProjectUtilsTest.java b/php.project/test/unit/src/org/netbeans/modules/php/project/util/PhpProjectUtilsTest.java --- a/php.project/test/unit/src/org/netbeans/modules/php/project/util/PhpProjectUtilsTest.java +++ b/php.project/test/unit/src/org/netbeans/modules/php/project/util/PhpProjectUtilsTest.java @@ -50,7 +50,7 @@ import org.netbeans.modules.php.api.util.StringUtils; import org.netbeans.modules.php.project.ui.customizer.PhpProjectProperties; import static org.junit.Assert.*; -import org.netbeans.modules.php.api.util.Pair; +import org.openide.util.Pair; public class PhpProjectUtilsTest extends NbTestCase { diff --git a/php.symfony/manifest.mf b/php.symfony/manifest.mf --- a/php.symfony/manifest.mf +++ b/php.symfony/manifest.mf @@ -2,5 +2,5 @@ OpenIDE-Module: org.netbeans.modules.php.symfony OpenIDE-Module-Layer: org/netbeans/modules/php/symfony/resources/layer.xml OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/symfony/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 1.30 +OpenIDE-Module-Specification-Version: 1.31 diff --git a/php.symfony/nbproject/project.xml b/php.symfony/nbproject/project.xml --- a/php.symfony/nbproject/project.xml +++ b/php.symfony/nbproject/project.xml @@ -74,7 +74,7 @@ 0 - 0.1 + 0.12 @@ -83,7 +83,7 @@ 0 - 0.3 + 0.14 @@ -100,7 +100,7 @@ - 2.18 + 2.19 @@ -196,7 +196,7 @@ - 8.22 + 8.32 diff --git a/php.symfony/src/org/netbeans/modules/php/symfony/SymfonyPhpModuleExtender.java b/php.symfony/src/org/netbeans/modules/php/symfony/SymfonyPhpModuleExtender.java --- a/php.symfony/src/org/netbeans/modules/php/symfony/SymfonyPhpModuleExtender.java +++ b/php.symfony/src/org/netbeans/modules/php/symfony/SymfonyPhpModuleExtender.java @@ -51,13 +51,13 @@ import org.netbeans.modules.php.api.executable.InvalidPhpExecutableException; import org.netbeans.modules.php.api.executable.PhpInterpreter; import org.netbeans.modules.php.api.phpmodule.PhpModule; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.spi.framework.PhpModuleExtender; import org.netbeans.modules.php.symfony.ui.wizards.NewProjectConfigurationPanel; import org.openide.filesystems.FileObject; import org.openide.util.Exceptions; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @author Tomas Mysik @@ -87,7 +87,7 @@ // generate apps for (Pair app : getPanel().getApps()) { - symfonyScript.initApp(phpModule, app.first, app.second); + symfonyScript.initApp(phpModule, app.first(), app.second()); } // prefetch commands diff --git a/php.symfony/src/org/netbeans/modules/php/symfony/ui/wizards/NewProjectConfigurationPanel.java b/php.symfony/src/org/netbeans/modules/php/symfony/ui/wizards/NewProjectConfigurationPanel.java --- a/php.symfony/src/org/netbeans/modules/php/symfony/ui/wizards/NewProjectConfigurationPanel.java +++ b/php.symfony/src/org/netbeans/modules/php/symfony/ui/wizards/NewProjectConfigurationPanel.java @@ -64,13 +64,13 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import org.netbeans.api.options.OptionsDisplayer; -import org.netbeans.modules.php.api.util.Pair; import org.netbeans.modules.php.api.util.StringUtils; import org.netbeans.modules.php.symfony.SymfonyScript; import org.netbeans.modules.php.symfony.ui.options.SymfonyOptions; import org.openide.awt.Mnemonics; import org.openide.util.ChangeSupport; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.Utilities; /** diff --git a/refactoring.java/nbproject/project.xml b/refactoring.java/nbproject/project.xml --- a/refactoring.java/nbproject/project.xml +++ b/refactoring.java/nbproject/project.xml @@ -294,7 +294,7 @@ - 8.0 + 8.32 diff --git a/refactoring.java/src/org/netbeans/modules/refactoring/java/Pair.java b/refactoring.java/src/org/netbeans/modules/refactoring/java/Pair.java deleted file mode 100644 --- a/refactoring.java/src/org/netbeans/modules/refactoring/java/Pair.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * Contributor(s): - * - * Portions Copyrighted 2007 Sun Microsystems, Inc. - */ -package org.netbeans.modules.refactoring.java; - -/** - * Copy from org.netbeans.modules.java.source.usages.Pair; - * @author Ralph Ruijs - */ -public final class Pair { - - public final P first; - public final K second; - - private Pair (P first, K second) { - this.first = first; - this.second = second; - } - - - public static Pair of (P first, K second) { - return new Pair (first,second); - } - - - @Override - public int hashCode () { - int hashCode = 0; - hashCode ^= first == null ? 0 : first.hashCode(); - hashCode ^= second == null ? 0: second.hashCode(); - return hashCode; - } - - @Override - public boolean equals (final Object other) { - if (other instanceof Pair) { - Pair otherPair = (Pair) other; - return (this.first == null ? otherPair.first == null : this.first.equals(otherPair.first)) && - (this.second == null ? otherPair.second == null : this.second.equals(otherPair.second)); - } - return false; - } - - @Override - public String toString () { - return String.format("Pair[%s,%s]", first,second); - } -} diff --git a/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/InlineMethodTransformer.java b/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/InlineMethodTransformer.java --- a/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/InlineMethodTransformer.java +++ b/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/InlineMethodTransformer.java @@ -77,12 +77,12 @@ import org.netbeans.api.java.source.GeneratorUtilities; import org.netbeans.api.java.source.TreePathHandle; import org.netbeans.modules.refactoring.api.Problem; -import org.netbeans.modules.refactoring.java.Pair; import org.netbeans.modules.refactoring.java.RefactoringUtils; import org.netbeans.modules.refactoring.java.api.JavaRefactoringUtils; import org.netbeans.modules.refactoring.java.spi.RefactoringVisitor; import org.openide.filesystems.FileUtil; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @@ -476,8 +476,8 @@ if(path != null) { el = trees.getElement(path); } - if (p.first.equals(el)) { - original2TranslatedBody.put(node, make.setLabel(node, p.second)); + if (p.first().equals(el)) { + original2TranslatedBody.put(node, make.setLabel(node, p.second())); } return super.visitIdentifier(node, p); } @@ -513,8 +513,8 @@ if(currentPath != null) { el = trees.getElement(currentPath); } - if (p.first.equals(el)) { - original2TranslatedBody.put(node, p.second); + if (p.first().equals(el)) { + original2TranslatedBody.put(node, p.second()); } return super.visitIdentifier(node, p); } diff --git a/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveMembersTransformer.java b/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveMembersTransformer.java --- a/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveMembersTransformer.java +++ b/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveMembersTransformer.java @@ -59,7 +59,6 @@ import org.netbeans.api.java.source.*; import org.netbeans.modules.refactoring.api.MoveRefactoring; import org.netbeans.modules.refactoring.api.Problem; -import org.netbeans.modules.refactoring.java.Pair; import org.netbeans.modules.refactoring.java.RefactoringUtils; import org.netbeans.modules.refactoring.java.api.JavaMoveMembersProperties; import org.netbeans.modules.refactoring.java.api.JavaMoveMembersProperties.Visibility; @@ -68,6 +67,7 @@ import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * @@ -648,8 +648,8 @@ public Void visitIdentifier(IdentifierTree node, Pair p) { TreePath currentPath = new TreePath(resolvedPath, node); Element el = trees.getElement(currentPath); - if (p.first.equals(el)) { - original2Translated.put(node, p.second); + if (p.first().equals(el)) { + original2Translated.put(node, p.second()); } return super.visitIdentifier(node, p); } diff --git a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanel.java b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanel.java --- a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanel.java +++ b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanel.java @@ -57,11 +57,11 @@ import org.netbeans.api.java.source.*; import org.netbeans.api.java.source.JavaSource.Phase; import org.netbeans.modules.refactoring.api.Scope; -import org.netbeans.modules.refactoring.java.Pair; import org.netbeans.modules.refactoring.spi.ui.CustomRefactoringPanel; import org.openide.filesystems.FileObject; import org.openide.util.NbBundle; import org.openide.util.NbPreferences; +import org.openide.util.Pair; import org.openide.util.lookup.Lookups; diff --git a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanelMethod.java b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanelMethod.java --- a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanelMethod.java +++ b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanelMethod.java @@ -57,8 +57,8 @@ import org.netbeans.api.java.source.CompilationController; import org.netbeans.api.java.source.TreePathHandle; import org.netbeans.api.java.source.ui.ElementIcons; -import org.netbeans.modules.refactoring.java.Pair; import org.netbeans.modules.refactoring.java.RefactoringModule; +import org.openide.util.Pair; /** * @@ -238,13 +238,13 @@ @SuppressWarnings("unchecked") String getMethodDeclaringClass() { Pair, TreePathHandle> selectedItem = (Pair, TreePathHandle>) jComboBox1.getSelectedItem(); - return selectedItem.first.first; + return selectedItem.first().first(); } @SuppressWarnings("unchecked") public TreePathHandle getMethodHandle() { Pair, TreePathHandle> selectedItem = (Pair, TreePathHandle>) jComboBox1.getSelectedItem(); - return selectedItem == null ? tph : selectedItem.second; + return selectedItem == null ? tph : selectedItem.second(); } public boolean isMethodFromBaseClass() { @@ -291,8 +291,8 @@ setIcon(getEmptyIcon()); } else { Pair, TreePathHandle> selectedPair = (Pair, TreePathHandle>) value; - setText(selectedPair.first.first); - setIcon(selectedPair.first.second); + setText(selectedPair.first().first()); + setIcon(selectedPair.first().second()); } } else { setText(null); diff --git a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedQueryUI.java b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedQueryUI.java --- a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedQueryUI.java +++ b/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedQueryUI.java @@ -64,7 +64,6 @@ import org.netbeans.modules.refactoring.api.AbstractRefactoring; import org.netbeans.modules.refactoring.api.Scope; import org.netbeans.modules.refactoring.api.WhereUsedQuery; -import org.netbeans.modules.refactoring.java.Pair; import org.netbeans.modules.refactoring.java.RefactoringUtils; import org.netbeans.modules.refactoring.java.api.JavaRefactoringUtils; import org.netbeans.modules.refactoring.java.api.WhereUsedQueryConstants; @@ -73,6 +72,7 @@ import org.openide.filesystems.FileObject; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.lookup.Lookups; /** diff --git a/spellchecker.bindings.htmlxml/nbproject/project.xml b/spellchecker.bindings.htmlxml/nbproject/project.xml --- a/spellchecker.bindings.htmlxml/nbproject/project.xml +++ b/spellchecker.bindings.htmlxml/nbproject/project.xml @@ -66,6 +66,14 @@ + org.openide.util + + + + 8.32 + + + org.openide.util.lookup @@ -73,14 +81,6 @@ 8.16 - - org.openide.util - - - - 8.2 - - diff --git a/spellchecker.bindings.htmlxml/src/org/netbeans/modules/spellchecker/bindings/htmlxml/Pair.java b/spellchecker.bindings.htmlxml/src/org/netbeans/modules/spellchecker/bindings/htmlxml/Pair.java deleted file mode 100644 --- a/spellchecker.bindings.htmlxml/src/org/netbeans/modules/spellchecker/bindings/htmlxml/Pair.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * Contributor(s): - * - * Portions Copyrighted 2007-2008 Sun Microsystems, Inc. - */ -package org.netbeans.modules.spellchecker.bindings.htmlxml; - -/** - * - * @author Tor Norbye - */ -public class Pair { - - A a; - B b; - - public Pair(A a, B b) { - this.a = a; - this.b = b; - } -} diff --git a/web.clientproject.api/manifest.mf b/web.clientproject.api/manifest.mf --- a/web.clientproject.api/manifest.mf +++ b/web.clientproject.api/manifest.mf @@ -1,5 +1,5 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.web.clientproject.api OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/clientproject/api/Bundle.properties -OpenIDE-Module-Specification-Version: 1.27 +OpenIDE-Module-Specification-Version: 1.28 diff --git a/web.clientproject.api/nbproject/project.xml b/web.clientproject.api/nbproject/project.xml --- a/web.clientproject.api/nbproject/project.xml +++ b/web.clientproject.api/nbproject/project.xml @@ -90,7 +90,7 @@ - 1.34 + 1.46 @@ -146,7 +146,7 @@ - 8.26 + 8.32 diff --git a/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/jslibs/JavaScriptLibraryCustomizerPanel.java b/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/jslibs/JavaScriptLibraryCustomizerPanel.java --- a/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/jslibs/JavaScriptLibraryCustomizerPanel.java +++ b/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/jslibs/JavaScriptLibraryCustomizerPanel.java @@ -73,7 +73,6 @@ import org.netbeans.modules.web.clientproject.api.util.StringUtilities; import org.netbeans.modules.web.clientproject.api.validation.FolderValidator; import org.netbeans.modules.web.clientproject.api.validation.ValidationResult; -import org.netbeans.modules.web.common.api.Pair; import org.netbeans.spi.project.ui.support.ProjectCustomizer; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; @@ -81,6 +80,7 @@ import org.openide.filesystems.FileUtil; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.Parameters; /** diff --git a/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/jslibs/JavaScriptLibrarySelectionPanel.java b/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/jslibs/JavaScriptLibrarySelectionPanel.java --- a/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/jslibs/JavaScriptLibrarySelectionPanel.java +++ b/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/jslibs/JavaScriptLibrarySelectionPanel.java @@ -96,13 +96,13 @@ import org.netbeans.api.project.libraries.Library; import org.netbeans.modules.web.clientproject.api.WebClientLibraryManager; import org.netbeans.modules.web.clientproject.api.util.StringUtilities; -import org.netbeans.modules.web.common.api.Pair; import org.netbeans.modules.web.common.api.Version; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.ChangeSupport; import org.openide.util.Mutex; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.RequestProcessor; import org.openide.util.WeakListeners; @@ -566,8 +566,8 @@ Pair, String> result = librariesValidator.validate(librariesFolder, newLibraries); // libraries invalidLibraries.clear(); - invalidLibraries.addAll(result.getA()); - return result.getB(); + invalidLibraries.addAll(result.first()); + return result.second(); } private void fireSelectedLibrariesChangeInEDT() { diff --git a/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/network/NetworkSupport.java b/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/network/NetworkSupport.java --- a/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/network/NetworkSupport.java +++ b/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/network/NetworkSupport.java @@ -63,12 +63,12 @@ import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.ProgressHandleFactory; import org.netbeans.modules.web.clientproject.api.network.ui.NetworkErrorPanel; -import org.netbeans.modules.web.common.api.Pair; import org.openide.DialogDescriptor; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.Cancellable; import org.openide.util.NbBundle; +import org.openide.util.Pair; import org.openide.util.Parameters; /** @@ -276,9 +276,9 @@ if (progressHandle != null) { progressHandle.progress(Bundle.NetworkSupport_progress_download(url)); } - InputStream is = downloadSetup.getA(); + InputStream is = downloadSetup.first(); try { - copyToFile(is, target, progressHandle, downloadSetup.getB()); + copyToFile(is, target, progressHandle, downloadSetup.second()); } catch (IOException ex) { // error => ensure file is deleted if (!target.delete()) { diff --git a/web.clientproject/manifest.mf b/web.clientproject/manifest.mf --- a/web.clientproject/manifest.mf +++ b/web.clientproject/manifest.mf @@ -3,4 +3,4 @@ OpenIDE-Module: org.netbeans.modules.web.clientproject OpenIDE-Module-Layer: org/netbeans/modules/web/clientproject/resources/layer.xml OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/clientproject/Bundle.properties -OpenIDE-Module-Specification-Version: 1.27 +OpenIDE-Module-Specification-Version: 1.28 diff --git a/web.clientproject/nbproject/project.xml b/web.clientproject/nbproject/project.xml --- a/web.clientproject/nbproject/project.xml +++ b/web.clientproject/nbproject/project.xml @@ -133,7 +133,7 @@ - 1.26 + 1.28 @@ -141,7 +141,7 @@ - 1.45 + 1.46 @@ -213,7 +213,7 @@ - 8.22 + 8.32 diff --git a/web.clientproject/src/org/netbeans/modules/web/clientproject/ui/wizard/JavaScriptLibrarySelectionPanel.java b/web.clientproject/src/org/netbeans/modules/web/clientproject/ui/wizard/JavaScriptLibrarySelectionPanel.java --- a/web.clientproject/src/org/netbeans/modules/web/clientproject/ui/wizard/JavaScriptLibrarySelectionPanel.java +++ b/web.clientproject/src/org/netbeans/modules/web/clientproject/ui/wizard/JavaScriptLibrarySelectionPanel.java @@ -63,13 +63,13 @@ import org.netbeans.modules.web.clientproject.spi.SiteTemplateImplementation; import org.netbeans.modules.web.clientproject.ui.customizer.ClientSideProjectProperties; import org.netbeans.modules.web.clientproject.util.FileUtilities; -import org.netbeans.modules.web.common.api.Pair; import org.openide.WizardDescriptor; import org.openide.WizardValidationException; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openide.util.Pair; public class JavaScriptLibrarySelectionPanel implements WizardDescriptor.AsynchronousValidatingPanel, WizardDescriptor.FinishablePanel { diff --git a/web.common/manifest.mf b/web.common/manifest.mf --- a/web.common/manifest.mf +++ b/web.common/manifest.mf @@ -1,5 +1,5 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.web.common OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/common/Bundle.properties -OpenIDE-Module-Specification-Version: 1.45 +OpenIDE-Module-Specification-Version: 1.46 diff --git a/web.common/nbproject/project.xml b/web.common/nbproject/project.xml --- a/web.common/nbproject/project.xml +++ b/web.common/nbproject/project.xml @@ -146,7 +146,7 @@ - 8.0 + 8.32 diff --git a/web.common/src/org/netbeans/modules/web/common/api/Pair.java b/web.common/src/org/netbeans/modules/web/common/api/Pair.java deleted file mode 100644 --- a/web.common/src/org/netbeans/modules/web/common/api/Pair.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2011 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - * - * Contributor(s): - * - * Portions Copyrighted 2011 Sun Microsystems, Inc. - */ -package org.netbeans.modules.web.common.api; - -/** - * - * @author Jan Lahoda - */ -public final class Pair { - - private final A a; - private final B b; - - public Pair(A a, B b) { - this.a = a; - this.b = b; - } - - public A getA() { - return a; - } - - public B getB() { - return b; - } - - public static Pair of(A a, B b) { - return new Pair(a, b); - } -} \ No newline at end of file diff --git a/web.el/nbproject/project.xml b/web.el/nbproject/project.xml --- a/web.el/nbproject/project.xml +++ b/web.el/nbproject/project.xml @@ -295,7 +295,7 @@ - 8.0 + 8.32 diff --git a/web.el/src/org/netbeans/modules/web/el/ELOccurrencesFinder.java b/web.el/src/org/netbeans/modules/web/el/ELOccurrencesFinder.java --- a/web.el/src/org/netbeans/modules/web/el/ELOccurrencesFinder.java +++ b/web.el/src/org/netbeans/modules/web/el/ELOccurrencesFinder.java @@ -65,6 +65,7 @@ import org.netbeans.modules.parsing.spi.SchedulerEvent; import org.openide.filesystems.FileObject; import org.openide.util.Exceptions; +import org.openide.util.Pair; /** * Occurrences finder for Expression Language. @@ -175,7 +176,7 @@ // the logic here is a bit strange, maybe should add new methods to ResourceBundles // for a more straightforward computation. // first, check whether the current EL elements has keys - keys.addAll(resourceBundles.collectKeys(target.first.getNode())); + keys.addAll(resourceBundles.collectKeys(target.first().getNode())); if (keys.isEmpty()) { return Collections.emptyMap(); } @@ -183,7 +184,7 @@ // second, if yes, check whether it has a key matching to the node under the caret boolean found = false; for (Pair pair : keys) { - if (pair.second.equals(target.second)) { + if (pair.second().equals(target.second())) { found = true; break; } @@ -198,8 +199,8 @@ continue; } for (Pair candidate : resourceBundles.collectKeys(each.getNode())) { - if (candidate.second.equals(target.second)) { - OffsetRange range = each.getOriginalOffset(candidate.second); + if (candidate.second().equals(target.second())) { + OffsetRange range = each.getOriginalOffset(candidate.second()); result.put(range, ColoringAttributes.MARK_OCCURRENCES); } } @@ -208,16 +209,16 @@ } private Map findMatchingTypes(CompilationContext info, ELParserResult parserResult, Pair target, List> candidates) { - Element targetType = ELTypeUtilities.resolveElement(info, target.first, target.second); + Element targetType = ELTypeUtilities.resolveElement(info, target.first(), target.second()); Map result = new HashMap(); for (Pair candidate : candidates) { if (checkAndResetCancel()) { return result; } - Element type = ELTypeUtilities.resolveElement(info, candidate.first, candidate.second); + Element type = ELTypeUtilities.resolveElement(info, candidate.first(), candidate.second()); if (type != null && type.equals(targetType)) { - OffsetRange range = candidate.first.getOriginalOffset(candidate.second); + OffsetRange range = candidate.first().getOriginalOffset(candidate.second()); result.put(range, ColoringAttributes.MARK_OCCURRENCES); } } diff --git a/web.el/src/org/netbeans/modules/web/el/Pair.java b/web.el/src/org/netbeans/modules/web/el/Pair.java deleted file mode 100644 --- a/web.el/src/org/netbeans/modules/web/el/Pair.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - * - * Contributor(s): - * - * Portions Copyrighted 2010 Sun Microsystems, Inc. - */ - -package org.netbeans.modules.web.el; - -/** - * - * @author Erno Mononen - */ -public final class Pair { - - public final P first; - public final K second; - - private Pair(P first, K second) { - this.first = first; - this.second = second; - } - - public static Pair of(P first, K second) { - return new Pair(first, second); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final Pair other = (Pair) obj; - if (this.first != other.first && (this.first == null || !this.first.equals(other.first))) { - return false; - } - if (this.second != other.second && (this.second == null || !this.second.equals(other.second))) { - return false; - } - return true; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 83 * hash + (this.first != null ? this.first.hashCode() : 0); - hash = 83 * hash + (this.second != null ? this.second.hashCode() : 0); - return hash; - } - - @Override - public String toString() { - return "Pair{" + "first=" + first + "second=" + second + '}'; - } - -} diff --git a/web.el/src/org/netbeans/modules/web/el/ResourceBundles.java b/web.el/src/org/netbeans/modules/web/el/ResourceBundles.java --- a/web.el/src/org/netbeans/modules/web/el/ResourceBundles.java +++ b/web.el/src/org/netbeans/modules/web/el/ResourceBundles.java @@ -61,6 +61,7 @@ import org.netbeans.modules.web.el.spi.ResourceBundle; import org.netbeans.spi.java.classpath.ClassPathProvider; import org.openide.filesystems.*; +import org.openide.util.Pair; import org.openide.util.Parameters; import org.openide.util.WeakListeners; diff --git a/web.el/src/org/netbeans/modules/web/el/completion/ELSanitizer.java b/web.el/src/org/netbeans/modules/web/el/completion/ELSanitizer.java --- a/web.el/src/org/netbeans/modules/web/el/completion/ELSanitizer.java +++ b/web.el/src/org/netbeans/modules/web/el/completion/ELSanitizer.java @@ -49,7 +49,7 @@ import org.netbeans.modules.web.el.ELElement; import org.netbeans.modules.web.el.ELParser; import org.netbeans.modules.web.el.ELPreprocessor; -import org.netbeans.modules.web.el.Pair; +import org.openide.util.Pair; /** * Attempts to sanitize EL statements. Check the unit test @@ -146,9 +146,9 @@ } // special handling for brackets for (Pair bracket : BRACKETS) { - if (expression.endsWith(bracket.first.fixedText())) { - return expression + bracket.second.fixedText(); - } else if (expression.endsWith(bracket.second.fixedText())) { + if (expression.endsWith(bracket.first().fixedText())) { + return expression + bracket.second().fixedText(); + } else if (expression.endsWith(bracket.second().fixedText())) { return expression; } } diff --git a/web.el/src/org/netbeans/modules/web/el/hints/ResourceBundleKeys.java b/web.el/src/org/netbeans/modules/web/el/hints/ResourceBundleKeys.java --- a/web.el/src/org/netbeans/modules/web/el/hints/ResourceBundleKeys.java +++ b/web.el/src/org/netbeans/modules/web/el/hints/ResourceBundleKeys.java @@ -52,10 +52,10 @@ import org.netbeans.modules.web.el.CompilationContext; import org.netbeans.modules.web.el.ELElement; import org.netbeans.modules.web.el.ELParserResult; -import org.netbeans.modules.web.el.Pair; import org.netbeans.modules.web.el.ResourceBundles; import org.openide.filesystems.FileObject; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * Hint for checking unknown resource bundle keys. @@ -95,12 +95,12 @@ continue; } for (Pair pair : resourceBundles.collectKeys(each.getNode(), info.context())) { - String clearedKey = pair.second.getImage().replace("'", "").replace("\"", ""); - if (!resourceBundles.isValidKey(pair.first.getImage(), clearedKey)) { + String clearedKey = pair.second().getImage().replace("'", "").replace("\"", ""); + if (!resourceBundles.isValidKey(pair.first().getImage(), clearedKey)) { Hint hint = new Hint(this, NbBundle.getMessage(ResourceBundleKeys.class, "ResourceBundleKeys_Unknown", clearedKey), elResult.getFileObject(), - each.getOriginalOffset(pair.second), + each.getOriginalOffset(pair.second()), Collections.emptyList(), 200); result.add(hint); } diff --git a/web.el/src/org/netbeans/modules/web/el/navigation/ELDeclarationFinder.java b/web.el/src/org/netbeans/modules/web/el/navigation/ELDeclarationFinder.java --- a/web.el/src/org/netbeans/modules/web/el/navigation/ELDeclarationFinder.java +++ b/web.el/src/org/netbeans/modules/web/el/navigation/ELDeclarationFinder.java @@ -63,9 +63,9 @@ import org.netbeans.modules.web.el.CompilationContext; import org.netbeans.modules.web.el.ELElement; import org.netbeans.modules.web.el.ELTypeUtilities; -import org.netbeans.modules.web.el.Pair; import org.openide.filesystems.FileObject; import org.openide.util.Exceptions; +import org.openide.util.Pair; /** * Simple DeclarationFinder based on the ELHyperlinkProvider code. @@ -90,7 +90,7 @@ public void run(CompilationController cc) throws Exception { cc.toPhase(JavaSource.Phase.RESOLVED); CompilationContext context = CompilationContext.create(file, cc); - Element javaElement = ELTypeUtilities.resolveElement(context, nodeElem.second, nodeElem.first); + Element javaElement = ELTypeUtilities.resolveElement(context, nodeElem.second(), nodeElem.first()); if (javaElement != null) { refs.handle = ElementHandle.create(javaElement); refs.fo = SourceUtils.getFile(refs.handle, cp); diff --git a/web.el/src/org/netbeans/modules/web/el/navigation/ELHyperlinkProvider.java b/web.el/src/org/netbeans/modules/web/el/navigation/ELHyperlinkProvider.java --- a/web.el/src/org/netbeans/modules/web/el/navigation/ELHyperlinkProvider.java +++ b/web.el/src/org/netbeans/modules/web/el/navigation/ELHyperlinkProvider.java @@ -93,11 +93,11 @@ import org.netbeans.modules.web.el.ELLanguage; import org.netbeans.modules.web.el.ELParserResult; import org.netbeans.modules.web.el.ELTypeUtilities; -import org.netbeans.modules.web.el.Pair; import org.netbeans.modules.web.el.ResourceBundles; import org.openide.filesystems.FileObject; import org.openide.util.Exceptions; import org.openide.util.NbBundle; +import org.openide.util.Pair; /** * Go to declaration for Expression Language. @@ -153,7 +153,7 @@ public String getTooltipText(Document doc, int offset, HyperlinkType type) { Pair nodeAndElement = resolveNodeAndElement(doc, offset, new AtomicBoolean()); if (nodeAndElement != null) { - if (nodeAndElement.first instanceof AstString) { + if (nodeAndElement.first() instanceof AstString) { // could be a resource bundle key return getTooltipTextForBundleKey(nodeAndElement); } else { @@ -165,7 +165,7 @@ private String getTooltipTextForElement(final Pair pair) { final String[] result = new String[1]; - final FileObject file = pair.second.getSnapshot().getSource().getFileObject(); + final FileObject file = pair.second().getSnapshot().getSource().getFileObject(); ClasspathInfo cp = ClasspathInfo.create(file); try { JavaSource.create(cp, file).runUserActionTask(new Task() { @@ -173,7 +173,7 @@ @Override public void run(CompilationController cc) throws Exception { cc.toPhase(JavaSource.Phase.RESOLVED); - final Element resolvedElement = ELTypeUtilities.resolveElement(CompilationContext.create(file, cc), pair.second, pair.first); + final Element resolvedElement = ELTypeUtilities.resolveElement(CompilationContext.create(file, cc), pair.second(), pair.first()); if (resolvedElement == null) { return; } @@ -190,17 +190,17 @@ } private String getTooltipTextForBundleKey(Pair pair) { - FileObject context = pair.second.getSnapshot().getSource().getFileObject(); + FileObject context = pair.second().getSnapshot().getSource().getFileObject(); ResourceBundles resourceBundles = ResourceBundles.get(context); if (!resourceBundles.canHaveBundles()) { return null; } - for (Pair each : resourceBundles.collectKeys(pair.second.getNode())) { - if (each.second.equals(pair.first)) { + for (Pair each : resourceBundles.collectKeys(pair.second().getNode())) { + if (each.second().equals(pair.first())) { StringBuilder result = new StringBuilder(); - String key = each.second.getImage(); - String value = resourceBundles.getValue(each.first.getImage(), each.second.getImage()); - String bundle = each.first.getImage(); + String key = each.second().getImage(); + String value = resourceBundles.getValue(each.first().getImage(), each.second().getImage()); + String bundle = each.first().getImage(); result.append("") /* displaying the bundle in the tooltip looks a bit strange, so commented out for now - maybe using a smaller font would @@ -273,7 +273,7 @@ @Override public void run(CompilationController cc) throws Exception { cc.toPhase(JavaSource.Phase.RESOLVED); - Element javaElement = ELTypeUtilities.resolveElement(CompilationContext.create(file, cc), nodeElem.second, nodeElem.first); + Element javaElement = ELTypeUtilities.resolveElement(CompilationContext.create(file, cc), nodeElem.second(), nodeElem.first()); if(javaElement != null) { handleRef.set(ElementHandle.create(javaElement)); } diff --git a/web.project/nbproject/project.properties b/web.project/nbproject/project.properties --- a/web.project/nbproject/project.properties +++ b/web.project/nbproject/project.properties @@ -56,7 +56,7 @@ javac.compilerargs=-Xlint:unchecked javadoc.arch=${basedir}/arch.xml -spec.version.base=1.46.0 +spec.version.base=1.47.0 # needed for the TestUtil class test.unit.cp.extra= diff --git a/web.project/nbproject/project.xml b/web.project/nbproject/project.xml --- a/web.project/nbproject/project.xml +++ b/web.project/nbproject/project.xml @@ -348,7 +348,7 @@ - 1.18 + 1.28