Skip to content

Commit

Permalink
Merge branch 'master' into migrate-annotation-attributes-proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
datho7561 committed Dec 2, 2022
2 parents 8e0411e + b8bdee9 commit c0d032f
Show file tree
Hide file tree
Showing 34 changed files with 169 additions and 33 deletions.
2 changes: 1 addition & 1 deletion org.eclipse.jdt.astview.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt.feature</groupId>
<artifactId>org.eclipse.jdt.astview.feature</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.astview/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.astview</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.core.manipulation/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.jdt.core.manipulation
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core.manipulation; singleton:=true
Bundle-Version: 1.17.0.qualifier
Bundle-Version: 1.17.100.qualifier
Bundle-Vendor: %providerName
Bundle-Activator: org.eclipse.jdt.internal.core.manipulation.JavaManipulationPlugin
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ private void addTypeQualification(final Type type, final CompilationUnitRewrite
Assert.isNotNull(type);
Assert.isNotNull(targetRewrite);
final ITypeBinding binding= type.resolveBinding();
if (binding != null) {
if (!type.isVar() && binding != null) {
final ITypeBinding declaring= binding.getDeclaringClass();
if (declaring != null) {
if (type instanceof SimpleType) {
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.jdt.core.manipulation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core.manipulation</artifactId>
<version>1.17.0-SNAPSHOT</version>
<version>1.17.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
2 changes: 1 addition & 1 deletion org.eclipse.jdt.jeview.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt.feature</groupId>
<artifactId>org.eclipse.jdt.jeview.feature</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.jeview/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.jeview</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.junit.core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.junit.core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.junit.runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.junit.runtime</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.junit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.junit</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.junit4.runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.junit4.runtime</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.junit5.runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.junit5.runtime</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.text.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
<relativePath>../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.jdt</groupId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ui.examples.projects/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.ui.examples.projects</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ui.junit.sampleproject/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt.ui</groupId>
<artifactId>org.eclipse.jdt.ui.junit.sampleproject</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ui.tests.refactoring/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.jdt.ui.tests.refactoring
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.jdt.ui.tests.refactoring; singleton:=true
Bundle-Version: 3.14.500.qualifier
Bundle-Version: 3.14.600.qualifier
Bundle-Activator: org.eclipse.jdt.ui.tests.refactoring.infra.RefactoringTestPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Plugin.providerName
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.jdt.ui.tests.refactoring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
<relativePath>../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.ui.tests.refactoring</artifactId>
<version>3.14.500-SNAPSHOT</version>
<version>3.14.600-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<testSuite>${project.artifactId}</testSuite>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package p1;

public class Foo {
class Bar {
static class X {
static void method() {
var x = new X();
System.out.println(x);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
*
*/
package p1;

class Bar {
static class X {
static void method() {
var x = new X();
System.out.println(x);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package p1;

public class Foo {
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
ExtractSupertypeTests.class,
MoveInnerToTopLevelTests.class,
MoveInnerToTopLevelTests16.class,
MoveInnerToNewTests10.class,
MoveInnerToNewTests16.class,
UseSupertypeWherePossibleTests.class,
UseSupertypeWherePossibleTests16.class,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*******************************************************************************
* Copyright (c) 2019, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
* Red Hat Inc. - created based on MoveMembersTests
*******************************************************************************/
package org.eclipse.jdt.ui.tests.refactoring;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import org.eclipse.core.runtime.NullProgressMonitor;

import org.eclipse.ltk.core.refactoring.RefactoringStatus;

import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;

import org.eclipse.jdt.internal.corext.refactoring.RefactoringAvailabilityTester;
import org.eclipse.jdt.internal.corext.refactoring.structure.MoveInnerToTopRefactoring;

import org.eclipse.jdt.ui.tests.refactoring.rules.Java10Setup;

import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;

public class MoveInnerToNewTests10 extends GenericRefactoringTest {
private static final String REFACTORING_PATH= "MoveInnerToNew10/";

public MoveInnerToNewTests10() {
rts= new Java10Setup();
}

@Override
public void genericbefore() throws Exception {
super.genericbefore();
fIsPreDeltaTest= true;
}

@Override
protected String getRefactoringPath() {
return REFACTORING_PATH;
}

//---
private IPackageFragment createPackage(String name) throws Exception{
return getRoot().createPackageFragment(name, true, null);
}

private ICompilationUnit createCu(IPackageFragment pack, String cuPath, String cuName) throws Exception{
return createCU(pack, cuName, getFileContents(getRefactoringPath() + cuPath));
}

@Test
public void test_Bug567020_Issue338_0() throws Exception{
ParticipantTesting.reset();
final String p1Name= "p1";
final String inDir= "/in/";
final String outDir= "/out/";

IPackageFragment packP1= createPackage(p1Name);
ICompilationUnit p1Foo= createCu(packP1, getName() + inDir + p1Name + "/Foo.java", "Foo.java");
IType fooType= p1Foo.getTypes()[0];
IType barType= fooType.getTypes()[0];

assertTrue("should be enabled", RefactoringAvailabilityTester.isMoveInnerAvailable(barType));
MoveInnerToTopRefactoring ref= ((RefactoringAvailabilityTester.isMoveInnerAvailable(barType)) ? new MoveInnerToTopRefactoring(barType, JavaPreferencesSettings.getCodeGenerationSettings(barType.getJavaProject())) : null);
assertNotNull("MoveInnerToTopRefactoring should not be null", ref);
RefactoringStatus preconditionResult= ref.checkInitialConditions(new NullProgressMonitor());
assertTrue("activation was supposed to be successful" + preconditionResult.toString(), preconditionResult.isOK());


RefactoringStatus checkInputResult= ref.checkFinalConditions(new NullProgressMonitor());
assertFalse("precondition was supposed to pass", checkInputResult.hasError());
performChange(ref, false);

assertEquals("p1 files", 2, packP1.getChildren().length);

String expectedSource= getFileContents(getRefactoringPath() + getName() + outDir + p1Name + "/Foo.java");
assertEqualLines("incorrect update of Foo", expectedSource, packP1.getCompilationUnit("Foo.java").getSource());

expectedSource= getFileContents(getRefactoringPath() + getName() + outDir + p1Name + "/Bar.java");
assertEqualLines("incorrect creation of Bar", expectedSource, packP1.getCompilationUnit("Bar.java").getSource());

}

}
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ui.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
<relativePath>../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.jdt</groupId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ui.unittest.junit.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt.feature</groupId>
<artifactId>org.eclipse.jdt.ui.unittest.junit.feature</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ui.unittest.junit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.ui.unittest.junit</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.jdt.ui
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.ui; singleton:=true
Bundle-Version: 3.27.100.qualifier
Bundle-Version: 3.27.200.qualifier
Bundle-Activator: org.eclipse.jdt.internal.ui.JavaPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.jdt.ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.ui</artifactId>
<version>3.27.100-SNAPSHOT</version>
<version>3.27.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<code.ignoredWarnings>-warn:-deprecation,unavoidableGenericProblems</code.ignoredWarnings>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.swt.dnd.ByteArrayTransfer;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.HTMLTransfer;
import org.eclipse.swt.dnd.RTFTransfer;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
Expand Down Expand Up @@ -425,8 +426,8 @@ private void doCutCopyWithImportsOperation() {
if (textData == null)
return;

ArrayList<Object> datas= new ArrayList<>(3);
ArrayList<ByteArrayTransfer> transfers= new ArrayList<>(3);
ArrayList<Object> datas= new ArrayList<>(4);
ArrayList<ByteArrayTransfer> transfers= new ArrayList<>(4);
datas.add(textData);
transfers.add(TextTransfer.getInstance());

Expand All @@ -436,6 +437,12 @@ private void doCutCopyWithImportsOperation() {
transfers.add(RTFTransfer.getInstance());
}

Object htmlData= clipboard.getContents(HTMLTransfer.getInstance());
if (htmlData != null) {
datas.add(htmlData);
transfers.add(HTMLTransfer.getInstance());
}

datas.add(clipboardData);
transfers.add(fgTransferInstance);

Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.ltk.core.refactoring.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.26.0-SNAPSHOT</version>
<version>4.27.0-SNAPSHOT</version>
<relativePath>../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.ltk</groupId>
Expand Down
Loading

0 comments on commit c0d032f

Please sign in to comment.