IDEA-19061 Integrate the Rearranger-plugin into core-IDEA

1. Arrangement API provides 'dependent entries' concept now;
2. Java static and instance initialization blocks are defined to be 'dependent arrangement entries';
3. Corresponding tests are added;
4. Default java arrangement rules are expanded in order to preserve old 'generated class members order';
5. Test data is corrected;
This commit is contained in:
Denis.Zhdanov
2012-09-06 13:21:41 +04:00
parent 4a4aa01505
commit e76b02dc4e
19 changed files with 300 additions and 31 deletions
@@ -1,9 +1,25 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Inner Class 'MyCollection'" "true"
public class Test {
public static void main() {
Collection[] cc = new MyCollection[10];
}
<caret>
private static class MyCollection {
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Inner Class 'MyTableModel'" "true"
import javax.swing.*;
import javax.swing.table.TableModel;
@@ -6,7 +22,7 @@ public class Test {
public static void main() {
JTable table = new JTable(new MyTableModel());
}
<caret>
private static class MyTableModel implements TableModel {
}
}
@@ -1,9 +1,25 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// "Create Inner Class 'Generic'" "true"
class Test {
void foo () {
new Generic<String> ();
}
<caret>
private class Generic<T> {
}
}
@@ -58,7 +58,6 @@ public class TestClass {
return yearsTo( expiry );
}
return 0.0;
}
private double yearsTo( final Date endDate ) {
@@ -41,7 +41,6 @@ public class TestClass {
return yearsTo( expiry );
}
return 0.0;
}
private double riskFactor() {
@@ -1,7 +1,21 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class X {
A myField;
private final Base myDelegate = new Base();
A myField;
public void method(Test t) {
myField = t.getA();
myField.methodFromA();
@@ -1,6 +1,21 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class A {
int fieldFromA;
private final MyBase myDelegate = new MyBase();
int fieldFromA;
public void firstMethodFromBase() {
myDelegate.firstMethodFromBase();
@@ -1,6 +1,21 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class Test {
private Foo myFoo;
private final Foo foo;
private Foo myFoo;
Test() {
foo = new Foo();
@@ -1,6 +1,21 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class Test {
private String myTimer;
private final String string;
private String myTimer;
Test() {
string = "";<caret>
@@ -1,6 +1,21 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class Test {
private String myTimer;
private final String string;
private String myTimer;
Test() {
string = "";