|
Lines 1242-1248
Link Here
|
| 1242 |
"public class Test {\n" + |
1242 |
"public class Test {\n" + |
| 1243 |
"\n" + |
1243 |
"\n" + |
| 1244 |
" String foo(boolean enabled) {\n" + |
1244 |
" String foo(boolean enabled) {\n" + |
| 1245 |
" if (enabled) {\n" + |
1245 |
" if (enabled)\n" + |
|
|
1246 |
" {\n" + |
| 1246 |
" // we need x\n" + |
1247 |
" // we need x\n" + |
| 1247 |
" // we need a select\n" + |
1248 |
" // we need a select\n" + |
| 1248 |
" return \"select x \"\n" + |
1249 |
" return \"select x \"\n" + |
|
Lines 1272-1278
Link Here
|
| 1272 |
"public class Test {\n" + |
1273 |
"public class Test {\n" + |
| 1273 |
"\n" + |
1274 |
"\n" + |
| 1274 |
" String foo(boolean enabled) {\n" + |
1275 |
" String foo(boolean enabled) {\n" + |
| 1275 |
" if (enabled) {\n" + |
1276 |
" if (enabled)\n" + |
|
|
1277 |
" {\n" + |
| 1276 |
" // we need x\n" + |
1278 |
" // we need x\n" + |
| 1277 |
" // we need a select\n" + |
1279 |
" // we need a select\n" + |
| 1278 |
" return \"select x \"\n" + |
1280 |
" return \"select x \"\n" + |
|
Lines 1897-1904
Link Here
|
| 1897 |
formatSource(source, |
1899 |
formatSource(source, |
| 1898 |
"@MessageDriven(mappedName = \"filiality/SchedulerMQService\",\n" + |
1900 |
"@MessageDriven(mappedName = \"filiality/SchedulerMQService\",\n" + |
| 1899 |
" activationConfig = {\n" + |
1901 |
" activationConfig = {\n" + |
| 1900 |
" @ActivationConfigProperty(propertyName = \"cronTrigger\",\n" + |
1902 |
" @ActivationConfigProperty(propertyName = \"cronTrigger\",\n" + |
| 1901 |
" propertyValue = \"0/10 * * * * ?\")\n" + |
1903 |
" propertyValue = \"0/10 * * * * ?\")\n" + |
| 1902 |
" })\n" + |
1904 |
" })\n" + |
| 1903 |
"@RunAs(\"admin\")\n" + |
1905 |
"@RunAs(\"admin\")\n" + |
| 1904 |
"@ResourceAdapter(\"quartz-ra.rar\")\n" + |
1906 |
"@ResourceAdapter(\"quartz-ra.rar\")\n" + |
|
Lines 2621-2628
Link Here
|
| 2621 |
" }\n" + |
2623 |
" }\n" + |
| 2622 |
"}\n"; |
2624 |
"}\n"; |
| 2623 |
formatSource(source, |
2625 |
formatSource(source, |
| 2624 |
"public class Test {\n" + |
2626 |
"public class Test\n" + |
| 2625 |
" public void aMethod() {\n" + |
2627 |
"{\n" + |
|
|
2628 |
" public void aMethod()\n" + |
| 2629 |
" {\n" + |
| 2626 |
" Object anObject = new Object()\n" + |
2630 |
" Object anObject = new Object()\n" + |
| 2627 |
" {\n" + |
2631 |
" {\n" + |
| 2628 |
" boolean aVariable;\n" + |
2632 |
" boolean aVariable;\n" + |
|
Lines 2689-2696
Link Here
|
| 2689 |
" }\n" + |
2693 |
" }\n" + |
| 2690 |
"}\n"; |
2694 |
"}\n"; |
| 2691 |
formatSource(source, |
2695 |
formatSource(source, |
| 2692 |
"public class Test {\n" + |
2696 |
"public class Test\n" + |
| 2693 |
" public void aMethod() {\n" + |
2697 |
"{\n" + |
|
|
2698 |
" public void aMethod()\n" + |
| 2699 |
" {\n" + |
| 2694 |
" Object anObject = new Object()\n" + |
2700 |
" Object anObject = new Object()\n" + |
| 2695 |
" {\n" + |
2701 |
" {\n" + |
| 2696 |
" boolean aVariable;\n" + |
2702 |
" boolean aVariable;\n" + |
|
Lines 2721-3118
Link Here
|
| 2721 |
" }\n" + |
2727 |
" }\n" + |
| 2722 |
"}\n"; |
2728 |
"}\n"; |
| 2723 |
formatSource(source, |
2729 |
formatSource(source, |
| 2724 |
"public class Test {\n" + |
|
|
| 2725 |
" public void aMethod() {\n" + |
| 2726 |
" Object anObject = new Object() /* comment */\n" + |
| 2727 |
" {\n" + |
| 2728 |
" boolean aVariable;\n" + |
| 2729 |
"\n" + |
| 2730 |
" void foo() /* comment */\n" + |
| 2731 |
" {\n" + |
| 2732 |
" }\n" + |
| 2733 |
" };\n" + |
| 2734 |
" }\n" + |
| 2735 |
"}\n" |
| 2736 |
); |
| 2737 |
} |
| 2738 |
public void testBug286601e() { |
| 2739 |
this.formatterPrefs.join_wrapped_lines = false; |
| 2740 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 2741 |
String source = |
| 2742 |
"public class Test\n" + |
| 2743 |
"{\n" + |
| 2744 |
" public void build(String href) {\n" + |
| 2745 |
" // set the href on the related topic\n" + |
| 2746 |
" if (href == null)\n" + |
| 2747 |
" setHref(\"\"); //$NON-NLS-1$\n" + |
| 2748 |
" else {\n" + |
| 2749 |
" if (!href.equals(\"\") // no empty link //$NON-NLS-1$\n" + |
| 2750 |
" && !href.startsWith(\"/\") // no help url //$NON-NLS-1$\n" + |
| 2751 |
" && href.indexOf(\':\') == -1) // no other protocols\n" + |
| 2752 |
" {\n" + |
| 2753 |
" setHref(\"/test/\" + href); //$NON-NLS-1$ //$NON-NLS-2$\n" + |
| 2754 |
" }\n" + |
| 2755 |
" }\n" + |
| 2756 |
" }\n" + |
| 2757 |
"}\n"; |
| 2758 |
formatSource(source, |
| 2759 |
"public class Test\n" + |
2730 |
"public class Test\n" + |
| 2760 |
"{\n" + |
2731 |
"{\n" + |
| 2761 |
" public void build(String href)\n" + |
2732 |
" public void aMethod()\n" + |
| 2762 |
" {\n" + |
2733 |
" {\n" + |
| 2763 |
" // set the href on the related topic\n" + |
2734 |
" Object anObject = new Object() /* comment */\n" + |
| 2764 |
" if (href == null)\n" + |
|
|
| 2765 |
" setHref(\"\"); //$NON-NLS-1$\n" + |
| 2766 |
" else\n" + |
| 2767 |
" {\n" + |
2735 |
" {\n" + |
| 2768 |
" if (!href.equals(\"\") // no empty link //$NON-NLS-1$\n" + |
2736 |
" boolean aVariable;\n" + |
| 2769 |
" && !href.startsWith(\"/\") // no help url //$NON-NLS-1$\n" + |
|
|
| 2770 |
" && href.indexOf(\':\') == -1) // no other protocols\n" + |
| 2771 |
" {\n" + |
| 2772 |
" setHref(\"/test/\" + href); //$NON-NLS-1$ //$NON-NLS-2$\n" + |
| 2773 |
" }\n" + |
| 2774 |
" }\n" + |
| 2775 |
" }\n" + |
| 2776 |
"}\n" |
| 2777 |
); |
| 2778 |
} |
| 2779 |
public void testBug286601f() { |
| 2780 |
this.formatterPrefs.join_wrapped_lines = false; |
| 2781 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 2782 |
String source = |
| 2783 |
"public class Test\n" + |
| 2784 |
"{\n" + |
| 2785 |
" \n" + |
| 2786 |
" private AntModel getAntModel(final File buildFile) {\n" + |
| 2787 |
" AntModel model= new AntModel(XMLCore.getDefault(), doc, null, new LocationProvider(null) {\n" + |
| 2788 |
" /* (non-Javadoc)\n" + |
| 2789 |
" * @see org.eclipse.ant.internal.ui.editor.outline.ILocationProvider#getLocation()\n" + |
| 2790 |
" */\n" + |
| 2791 |
" public IPath getLocation() {\n" + |
| 2792 |
" return new Path(buildFile.getAbsolutePath());\n" + |
| 2793 |
" }\n" + |
| 2794 |
" });\n" + |
| 2795 |
" model.reconcile(null);\n" + |
| 2796 |
" return model;\n" + |
| 2797 |
" }\n" + |
| 2798 |
"}\n"; |
| 2799 |
formatSource(source, |
| 2800 |
"public class Test\n" + |
| 2801 |
"{\n" + |
| 2802 |
"\n" + |
| 2803 |
" private AntModel getAntModel(final File buildFile)\n" + |
| 2804 |
" {\n" + |
| 2805 |
" AntModel model = new AntModel(XMLCore.getDefault(), doc, null,\n" + |
| 2806 |
" new LocationProvider(null)\n" + |
| 2807 |
" {\n" + |
| 2808 |
" /*\n" + |
| 2809 |
" * (non-Javadoc)\n" + |
| 2810 |
" * \n" + |
| 2811 |
" * @see\n" + |
| 2812 |
" * org.eclipse.ant.internal.ui.editor.outline.ILocationProvider\n" + |
| 2813 |
" * #getLocation()\n" + |
| 2814 |
" */\n" + |
| 2815 |
" public IPath getLocation()\n" + |
| 2816 |
" {\n" + |
| 2817 |
" return new Path(buildFile.getAbsolutePath());\n" + |
| 2818 |
" }\n" + |
| 2819 |
" });\n" + |
| 2820 |
" model.reconcile(null);\n" + |
| 2821 |
" return model;\n" + |
| 2822 |
" }\n" + |
| 2823 |
"}\n" |
| 2824 |
); |
| 2825 |
} |
| 2826 |
public void testBug286601g() { |
| 2827 |
this.formatterPrefs.join_wrapped_lines = false; |
| 2828 |
String source = |
| 2829 |
"package massive;\n" + |
| 2830 |
"\n" + |
| 2831 |
"public class X05\n" + |
| 2832 |
"{\n" + |
| 2833 |
"\n" + |
| 2834 |
" public void foo() throws NullPointerException {\n" + |
| 2835 |
"\n" + |
| 2836 |
" Object body = new Object() {\n" + |
| 2837 |
" public void run(StringBuffer monitor) throws IllegalArgumentException {\n" + |
| 2838 |
" IResourceVisitor visitor = new IResourceVisitor() {\n" + |
| 2839 |
" public boolean visit(String resource) throws IllegalArgumentException {\n" + |
| 2840 |
" return true;\n" + |
| 2841 |
" }\n" + |
| 2842 |
" };\n" + |
| 2843 |
" }\n" + |
| 2844 |
" };\n" + |
| 2845 |
" }\n" + |
| 2846 |
"\n" + |
| 2847 |
"}\n" + |
| 2848 |
"interface IResourceVisitor {\n" + |
| 2849 |
"}\n"; |
| 2850 |
formatSource(source, |
| 2851 |
"package massive;\n" + |
| 2852 |
"\n" + |
| 2853 |
"public class X05 {\n" + |
| 2854 |
"\n" + |
| 2855 |
" public void foo() throws NullPointerException {\n" + |
| 2856 |
"\n" + |
| 2857 |
" Object body = new Object() {\n" + |
| 2858 |
" public void run(StringBuffer monitor)\n" + |
| 2859 |
" throws IllegalArgumentException {\n" + |
| 2860 |
" IResourceVisitor visitor = new IResourceVisitor() {\n" + |
| 2861 |
" public boolean visit(String resource)\n" + |
| 2862 |
" throws IllegalArgumentException {\n" + |
| 2863 |
" return true;\n" + |
| 2864 |
" }\n" + |
| 2865 |
" };\n" + |
| 2866 |
" }\n" + |
| 2867 |
" };\n" + |
| 2868 |
" }\n" + |
| 2869 |
"\n" + |
| 2870 |
"}\n" + |
| 2871 |
"\n" + |
| 2872 |
"interface IResourceVisitor {\n" + |
| 2873 |
"}\n" |
| 2874 |
); |
| 2875 |
} |
| 2876 |
public void testBug286601h() { |
| 2877 |
this.formatterPrefs.join_wrapped_lines = false; |
| 2878 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 2879 |
String source = |
| 2880 |
"package massive;\n" + |
| 2881 |
"\n" + |
| 2882 |
"public class X05\n" + |
| 2883 |
"{\n" + |
| 2884 |
"\n" + |
| 2885 |
" public void foo() throws NullPointerException {\n" + |
| 2886 |
"\n" + |
| 2887 |
" Object body = new Object() {\n" + |
| 2888 |
" public void run(StringBuffer monitor) throws IllegalArgumentException {\n" + |
| 2889 |
" IResourceVisitor visitor = new IResourceVisitor() {\n" + |
| 2890 |
" public boolean visit(String resource) throws IllegalArgumentException {\n" + |
| 2891 |
" return true;\n" + |
| 2892 |
" }\n" + |
| 2893 |
" };\n" + |
| 2894 |
" }\n" + |
| 2895 |
" };\n" + |
| 2896 |
" }\n" + |
| 2897 |
"\n" + |
| 2898 |
"}\n" + |
| 2899 |
"interface IResourceVisitor {\n" + |
| 2900 |
"}\n"; |
| 2901 |
formatSource(source, |
| 2902 |
"package massive;\n" + |
| 2903 |
"\n" + |
| 2904 |
"public class X05\n" + |
| 2905 |
"{\n" + |
| 2906 |
"\n" + |
| 2907 |
" public void foo() throws NullPointerException\n" + |
| 2908 |
" {\n" + |
| 2909 |
"\n" + |
2737 |
"\n" + |
| 2910 |
" Object body = new Object()\n" + |
2738 |
" void foo() /* comment */\n" + |
| 2911 |
" {\n" + |
|
|
| 2912 |
" public void run(StringBuffer monitor)\n" + |
| 2913 |
" throws IllegalArgumentException\n" + |
| 2914 |
" {\n" + |
2739 |
" {\n" + |
| 2915 |
" IResourceVisitor visitor = new IResourceVisitor()\n" + |
|
|
| 2916 |
" {\n" + |
| 2917 |
" public boolean visit(String resource)\n" + |
| 2918 |
" throws IllegalArgumentException\n" + |
| 2919 |
" {\n" + |
| 2920 |
" return true;\n" + |
| 2921 |
" }\n" + |
| 2922 |
" };\n" + |
| 2923 |
" }\n" + |
2740 |
" }\n" + |
| 2924 |
" };\n" + |
2741 |
" };\n" + |
| 2925 |
" }\n" + |
2742 |
" }\n" + |
| 2926 |
"\n" + |
|
|
| 2927 |
"}\n" + |
| 2928 |
"\n" + |
| 2929 |
"interface IResourceVisitor\n" + |
| 2930 |
"{\n" + |
| 2931 |
"}\n" |
| 2932 |
); |
| 2933 |
} |
| 2934 |
public void testBug286601i1() { |
| 2935 |
this.formatterPrefs.join_wrapped_lines = false; |
| 2936 |
this.formatterPrefs.alignment_for_expressions_in_array_initializer = DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE; |
| 2937 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 2938 |
String source = |
| 2939 |
"package massive;\n" + |
| 2940 |
"\n" + |
| 2941 |
"public class X06a {\n" + |
| 2942 |
"\n" + |
| 2943 |
" \n" + |
| 2944 |
" // Table to merge access modes for condition statements (e.g branch[x] || branch[y]). \n" + |
| 2945 |
" private static final String[][] ACCESS_MODE_CONDITIONAL_TABLE= {\n" + |
| 2946 |
" /* Comment 1 */\n" + |
| 2947 |
" /* Comment 2 */ { \"1234567890123456789012345678901234567890\", \"1234567890123456789012345678901234567890\" },\n" + |
| 2948 |
" /* Comment 3 */ { \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\" },\n" + |
| 2949 |
" };\n" + |
| 2950 |
"\n" + |
| 2951 |
"}\n"; |
| 2952 |
formatSource(source, |
| 2953 |
"package massive;\n" + |
| 2954 |
"\n" + |
| 2955 |
"public class X06a\n" + |
| 2956 |
"{\n" + |
| 2957 |
"\n" + |
| 2958 |
" // Table to merge access modes for condition statements (e.g branch[x] ||\n" + |
| 2959 |
" // branch[y]).\n" + |
| 2960 |
" private static final String[][] ACCESS_MODE_CONDITIONAL_TABLE =\n" + |
| 2961 |
" {\n" + |
| 2962 |
" /* Comment 1 */\n" + |
| 2963 |
" /* Comment 2 */{ \"1234567890123456789012345678901234567890\", \"1234567890123456789012345678901234567890\" },\n" + |
| 2964 |
" /* Comment 3 */{ \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\" },\n" + |
| 2965 |
" };\n" + |
| 2966 |
"\n" + |
| 2967 |
"}\n" |
2743 |
"}\n" |
| 2968 |
); |
2744 |
); |
| 2969 |
} |
2745 |
} |
| 2970 |
public void testBug286601i2() { |
2746 |
public void testBug286601_massive_01() { |
| 2971 |
this.formatterPrefs.join_wrapped_lines = false; |
2747 |
this.formatterPrefs.join_wrapped_lines = false; |
| 2972 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; |
|
|
| 2973 |
this.formatterPrefs.alignment_for_expressions_in_array_initializer = DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE; |
| 2974 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
2748 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 2975 |
String source = |
2749 |
String source = |
| 2976 |
"package massive;\n" + |
2750 |
"package massive;\n" + |
| 2977 |
"\n" + |
2751 |
"public class X01 {\n" + |
| 2978 |
"public class X06a {\n" + |
2752 |
" public void build(String href) {\n" + |
| 2979 |
"\n" + |
2753 |
" // set the href on the related topic\n" + |
| 2980 |
" \n" + |
2754 |
" if (href == null)\n" + |
| 2981 |
" // Table to merge access modes for condition statements (e.g branch[x] || branch[y]). \n" + |
2755 |
" setHref(\"\"); //$NON-NLS-1$\n" + |
| 2982 |
" private static final String[][] ACCESS_MODE_CONDITIONAL_TABLE= {\n" + |
2756 |
" else {\n" + |
| 2983 |
" /* Comment 1 */\n" + |
2757 |
" if (!href.equals(\"\") // no empty link //$NON-NLS-1$\n" + |
| 2984 |
" /* Comment 2 */ { \"1234567890123456789012345678901234567890\", \"1234567890123456789012345678901234567890\" },\n" + |
2758 |
" && !href.startsWith(\"/\") // no help url //$NON-NLS-1$\n" + |
| 2985 |
" /* Comment 3 */ { \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\" },\n" + |
2759 |
" && href.indexOf(\':\') == -1) // no other protocols\n" + |
| 2986 |
" };\n" + |
2760 |
" {\n" + |
| 2987 |
"\n" + |
2761 |
" setHref(\"/test/\" + href); //$NON-NLS-1$ //$NON-NLS-2$\n" + |
|
|
2762 |
" }\n" + |
| 2763 |
" }\n" + |
| 2764 |
" }\n" + |
| 2765 |
"\n" + |
| 2766 |
" private void setHref(String string)\n" + |
| 2767 |
" {\n" + |
| 2768 |
" \n" + |
| 2769 |
" }\n" + |
| 2988 |
"}\n"; |
2770 |
"}\n"; |
| 2989 |
formatSource(source, |
2771 |
formatSource(source, |
| 2990 |
"package massive;\n" + |
2772 |
"package massive;\n" + |
| 2991 |
"\n" + |
2773 |
"\n" + |
| 2992 |
"public class X06a\n" + |
2774 |
"public class X01\n" + |
| 2993 |
"{\n" + |
2775 |
"{\n" + |
| 2994 |
"\n" + |
2776 |
" public void build(String href)\n" + |
| 2995 |
" // Table to merge access modes for condition statements (e.g branch[x] ||\n" + |
2777 |
" {\n" + |
| 2996 |
" // branch[y]).\n" + |
2778 |
" // set the href on the related topic\n" + |
| 2997 |
" private static final String[][] ACCESS_MODE_CONDITIONAL_TABLE =\n" + |
2779 |
" if (href == null)\n" + |
| 2998 |
" {\n" + |
2780 |
" setHref(\"\"); //$NON-NLS-1$\n" + |
| 2999 |
" /* Comment 1 */\n" + |
2781 |
" else\n" + |
| 3000 |
" /* Comment 2 */{ \"1234567890123456789012345678901234567890\", \"1234567890123456789012345678901234567890\" },\n" + |
2782 |
" {\n" + |
| 3001 |
" /* Comment 3 */{ \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\" },\n" + |
2783 |
" if (!href.equals(\"\") // no empty link //$NON-NLS-1$\n" + |
| 3002 |
" };\n" + |
2784 |
" && !href.startsWith(\"/\") // no help url //$NON-NLS-1$\n" + |
| 3003 |
"\n" + |
2785 |
" && href.indexOf(\':\') == -1) // no other protocols\n" + |
|
|
2786 |
" {\n" + |
| 2787 |
" setHref(\"/test/\" + href); //$NON-NLS-1$ //$NON-NLS-2$\n" + |
| 2788 |
" }\n" + |
| 2789 |
" }\n" + |
| 2790 |
" }\n" + |
| 2791 |
"\n" + |
| 2792 |
" private void setHref(String string)\n" + |
| 2793 |
" {\n" + |
| 2794 |
"\n" + |
| 2795 |
" }\n" + |
| 3004 |
"}\n" |
2796 |
"}\n" |
| 3005 |
); |
2797 |
); |
| 3006 |
} |
2798 |
} |
| 3007 |
public void testBug286601j1() { |
2799 |
public void testBug286601_massive_02() { |
| 3008 |
this.formatterPrefs.join_wrapped_lines = false; |
2800 |
this.formatterPrefs.join_wrapped_lines = false; |
| 3009 |
this.formatterPrefs.alignment_for_expressions_in_array_initializer = DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE; |
|
|
| 3010 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
2801 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 3011 |
String source = |
2802 |
String source = |
| 3012 |
"package massive;\n" + |
2803 |
"package massive;\n" + |
| 3013 |
"\n" + |
2804 |
"\n" + |
| 3014 |
"public class X06b {\n" + |
2805 |
"public class X02\n" + |
| 3015 |
"\n" + |
2806 |
"{\n" + |
| 3016 |
" \n" + |
2807 |
" \n" + |
| 3017 |
" // Table to merge access modes for condition statements (e.g branch[x] || branch[y]). \n" + |
2808 |
" private AntModel getAntModel(final File buildFile) {\n" + |
| 3018 |
" private static final String[][] ACCESS_MODE_CONDITIONAL_TABLE= {\n" + |
2809 |
" AntModel model= new AntModel(XMLCore.getDefault(), doc, null, new LocationProvider(null) {\n" + |
| 3019 |
" { \"1234567890123456789012345678901234567890\", \"1234567890123456789012345678901234567890\" },\n" + |
2810 |
" /* (non-Javadoc)\n" + |
| 3020 |
" { \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\" },\n" + |
2811 |
" * @see org.eclipse.ant.internal.ui.editor.outline.ILocationProvider#getLocation()\n" + |
| 3021 |
" };\n" + |
2812 |
" */\n" + |
| 3022 |
"\n" + |
2813 |
" public IPath getLocation() {\n" + |
|
|
2814 |
" return new Path(buildFile.getAbsolutePath());\n" + |
| 2815 |
" }\n" + |
| 2816 |
" });\n" + |
| 2817 |
" model.reconcile(null);\n" + |
| 2818 |
" return model;\n" + |
| 2819 |
" }\n" + |
| 3023 |
"}\n"; |
2820 |
"}\n"; |
| 3024 |
formatSource(source, |
2821 |
formatSource(source, |
| 3025 |
"package massive;\n" + |
2822 |
"package massive;\n" + |
| 3026 |
"\n" + |
2823 |
"\n" + |
| 3027 |
"public class X06b\n" + |
2824 |
"public class X02\n" + |
| 3028 |
"{\n" + |
2825 |
"{\n" + |
| 3029 |
"\n" + |
2826 |
"\n" + |
| 3030 |
" // Table to merge access modes for condition statements (e.g branch[x] ||\n" + |
2827 |
" private AntModel getAntModel(final File buildFile)\n" + |
| 3031 |
" // branch[y]).\n" + |
2828 |
" {\n" + |
| 3032 |
" private static final String[][] ACCESS_MODE_CONDITIONAL_TABLE =\n" + |
2829 |
" AntModel model = new AntModel(XMLCore.getDefault(), doc, null,\n" + |
| 3033 |
" {\n" + |
2830 |
" new LocationProvider(null)\n" + |
| 3034 |
" { \"1234567890123456789012345678901234567890\", \"1234567890123456789012345678901234567890\" },\n" + |
2831 |
" {\n" + |
| 3035 |
" { \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\" },\n" + |
2832 |
" /*\n" + |
| 3036 |
" };\n" + |
2833 |
" * (non-Javadoc)\n" + |
| 3037 |
"\n" + |
2834 |
" * \n" + |
|
|
2835 |
" * @see\n" + |
| 2836 |
" * org.eclipse.ant.internal.ui.editor.outline.ILocationProvider\n" + |
| 2837 |
" * #getLocation()\n" + |
| 2838 |
" */\n" + |
| 2839 |
" public IPath getLocation()\n" + |
| 2840 |
" {\n" + |
| 2841 |
" return new Path(buildFile.getAbsolutePath());\n" + |
| 2842 |
" }\n" + |
| 2843 |
" });\n" + |
| 2844 |
" model.reconcile(null);\n" + |
| 2845 |
" return model;\n" + |
| 2846 |
" }\n" + |
| 3038 |
"}\n" |
2847 |
"}\n" |
| 3039 |
); |
2848 |
); |
| 3040 |
} |
2849 |
} |
| 3041 |
public void testBug286601j2() { |
2850 |
public void testBug286601_massive_03() { |
| 3042 |
this.formatterPrefs.join_wrapped_lines = false; |
2851 |
this.formatterPrefs.join_wrapped_lines = false; |
| 3043 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; |
|
|
| 3044 |
this.formatterPrefs.alignment_for_expressions_in_array_initializer = DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE; |
| 3045 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 3046 |
String source = |
2852 |
String source = |
| 3047 |
"package massive;\n" + |
2853 |
"package massive;\n" + |
| 3048 |
"\n" + |
2854 |
"\n" + |
| 3049 |
"public class X06b {\n" + |
2855 |
"public class X03\n" + |
| 3050 |
"\n" + |
2856 |
"{\n" + |
| 3051 |
" \n" + |
2857 |
"\n" + |
| 3052 |
" // Table to merge access modes for condition statements (e.g branch[x] || branch[y]). \n" + |
2858 |
" public void foo() throws NullPointerException {\n" + |
| 3053 |
" private static final String[][] ACCESS_MODE_CONDITIONAL_TABLE= {\n" + |
2859 |
"\n" + |
| 3054 |
" { \"1234567890123456789012345678901234567890\", \"1234567890123456789012345678901234567890\" },\n" + |
2860 |
" Object body = new Object() {\n" + |
| 3055 |
" { \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\" },\n" + |
2861 |
" public void run(StringBuffer monitor) throws IllegalArgumentException {\n" + |
| 3056 |
" };\n" + |
2862 |
" IResourceVisitor visitor = new IResourceVisitor() {\n" + |
| 3057 |
"\n" + |
2863 |
" public boolean visit(String resource) throws IllegalArgumentException {\n" + |
|
|
2864 |
" return true;\n" + |
| 2865 |
" }\n" + |
| 2866 |
" };\n" + |
| 2867 |
" }\n" + |
| 2868 |
" };\n" + |
| 2869 |
" }\n" + |
| 2870 |
"\n" + |
| 2871 |
"}\n" + |
| 2872 |
"interface IResourceVisitor {\n" + |
| 3058 |
"}\n"; |
2873 |
"}\n"; |
| 3059 |
formatSource(source, |
2874 |
formatSource(source, |
| 3060 |
"package massive;\n" + |
2875 |
"package massive;\n" + |
| 3061 |
"\n" + |
2876 |
"\n" + |
| 3062 |
"public class X06b\n" + |
2877 |
"public class X03\n" + |
| 3063 |
"{\n" + |
2878 |
"{\n" + |
| 3064 |
"\n" + |
2879 |
"\n" + |
| 3065 |
" // Table to merge access modes for condition statements (e.g branch[x] ||\n" + |
2880 |
" public void foo() throws NullPointerException {\n" + |
| 3066 |
" // branch[y]).\n" + |
2881 |
"\n" + |
| 3067 |
" private static final String[][] ACCESS_MODE_CONDITIONAL_TABLE =\n" + |
2882 |
" Object body = new Object() {\n" + |
| 3068 |
" {\n" + |
2883 |
" public void run(StringBuffer monitor)\n" + |
| 3069 |
" { \"1234567890123456789012345678901234567890\", \"1234567890123456789012345678901234567890\" },\n" + |
2884 |
" throws IllegalArgumentException {\n" + |
| 3070 |
" { \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\" },\n" + |
2885 |
" IResourceVisitor visitor = new IResourceVisitor() {\n" + |
| 3071 |
" };\n" + |
2886 |
" public boolean visit(String resource)\n" + |
| 3072 |
"\n" + |
2887 |
" throws IllegalArgumentException {\n" + |
|
|
2888 |
" return true;\n" + |
| 2889 |
" }\n" + |
| 2890 |
" };\n" + |
| 2891 |
" }\n" + |
| 2892 |
" };\n" + |
| 2893 |
" }\n" + |
| 2894 |
"\n" + |
| 2895 |
"}\n" + |
| 2896 |
"\n" + |
| 2897 |
"interface IResourceVisitor {\n" + |
| 3073 |
"}\n" |
2898 |
"}\n" |
| 3074 |
); |
2899 |
); |
| 3075 |
} |
2900 |
} |
| 3076 |
public void testBug286601k() { |
2901 |
public void testBug286601_wksp_03b() { |
| 3077 |
this.formatterPrefs.join_wrapped_lines = false; |
2902 |
this.formatterPrefs.join_wrapped_lines = false; |
| 3078 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; |
|
|
| 3079 |
this.formatterPrefs.alignment_for_expressions_in_array_initializer = DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE; |
| 3080 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
2903 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 3081 |
String source = |
2904 |
String source = |
| 3082 |
"package massive;\n" + |
2905 |
"package massive;\n" + |
| 3083 |
"\n" + |
2906 |
"\n" + |
| 3084 |
"public class X07 {\n" + |
2907 |
"public class X03\n" + |
| 3085 |
" private MinimizedFileSystemElement selectFiles(final Object rootFileSystemObject, final IImportStructureProvider structureProvider) {\n" + |
2908 |
"{\n" + |
| 3086 |
"\n" + |
2909 |
"\n" + |
| 3087 |
" BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {\n" + |
2910 |
" public void foo() throws NullPointerException {\n" + |
| 3088 |
" public void run() {\n" + |
2911 |
"\n" + |
| 3089 |
" //Create the root element from the supplied file system object\n" + |
2912 |
" Object body = new Object() {\n" + |
| 3090 |
" }\n" + |
2913 |
" public void run(StringBuffer monitor) throws IllegalArgumentException {\n" + |
| 3091 |
" });\n" + |
2914 |
" IResourceVisitor visitor = new IResourceVisitor() {\n" + |
| 3092 |
"\n" + |
2915 |
" public boolean visit(String resource) throws IllegalArgumentException {\n" + |
| 3093 |
" return null;\n" + |
2916 |
" return true;\n" + |
| 3094 |
" }\n" + |
2917 |
" }\n" + |
|
|
2918 |
" };\n" + |
| 2919 |
" }\n" + |
| 2920 |
" };\n" + |
| 2921 |
" }\n" + |
| 2922 |
"\n" + |
| 2923 |
"}\n" + |
| 2924 |
"interface IResourceVisitor {\n" + |
| 3095 |
"}\n"; |
2925 |
"}\n"; |
| 3096 |
formatSource(source, |
2926 |
formatSource(source, |
| 3097 |
"package massive;\n" + |
2927 |
"package massive;\n" + |
| 3098 |
"\n" + |
2928 |
"\n" + |
| 3099 |
"public class X07\n" + |
2929 |
"public class X03\n" + |
| 3100 |
"{\n" + |
2930 |
"{\n" + |
| 3101 |
" private MinimizedFileSystemElement selectFiles(\n" + |
2931 |
"\n" + |
| 3102 |
" final Object rootFileSystemObject,\n" + |
2932 |
" public void foo() throws NullPointerException\n" + |
| 3103 |
" final IImportStructureProvider structureProvider)\n" + |
2933 |
" {\n" + |
| 3104 |
" {\n" + |
2934 |
"\n" + |
| 3105 |
"\n" + |
2935 |
" Object body = new Object()\n" + |
| 3106 |
" BusyIndicator.showWhile(getShell().getDisplay(), new Runnable()\n" + |
2936 |
" {\n" + |
| 3107 |
" {\n" + |
2937 |
" public void run(StringBuffer monitor)\n" + |
| 3108 |
" public void run()\n" + |
2938 |
" throws IllegalArgumentException\n" + |
| 3109 |
" {\n" + |
2939 |
" {\n" + |
| 3110 |
" // Create the root element from the supplied file system object\n" + |
2940 |
" IResourceVisitor visitor = new IResourceVisitor()\n" + |
| 3111 |
" }\n" + |
2941 |
" {\n" + |
| 3112 |
" });\n" + |
2942 |
" public boolean visit(String resource)\n" + |
| 3113 |
"\n" + |
2943 |
" throws IllegalArgumentException\n" + |
| 3114 |
" return null;\n" + |
2944 |
" {\n" + |
| 3115 |
" }\n" + |
2945 |
" return true;\n" + |
|
|
2946 |
" }\n" + |
| 2947 |
" };\n" + |
| 2948 |
" }\n" + |
| 2949 |
" };\n" + |
| 2950 |
" }\n" + |
| 2951 |
"\n" + |
| 2952 |
"}\n" + |
| 2953 |
"\n" + |
| 2954 |
"interface IResourceVisitor\n" + |
| 2955 |
"{\n" + |
| 3116 |
"}\n" |
2956 |
"}\n" |
| 3117 |
); |
2957 |
); |
| 3118 |
} |
2958 |
} |
|
Lines 7019-7032
Link Here
|
| 7019 |
" MessageFormat\n" + |
6859 |
" MessageFormat\n" + |
| 7020 |
" .format(InternalAntMessages\n" + |
6860 |
" .format(InternalAntMessages\n" + |
| 7021 |
" .getString(\"InternalAntRunner.Buildfile__{0}_does_not_exist_!_1\"), //$NON-NLS-1$\n" + |
6861 |
" .getString(\"InternalAntRunner.Buildfile__{0}_does_not_exist_!_1\"), //$NON-NLS-1$\n" + |
| 7022 |
" new String[] { buildFile.getAbsolutePath() }));\n" + |
6862 |
" new String[] { buildFile.getAbsolutePath() }));\n" + |
| 7023 |
" }\n" + |
6863 |
" }\n" + |
| 7024 |
" if (!buildFile.isFile()) {\n" + |
6864 |
" if (!buildFile.isFile()) {\n" + |
| 7025 |
" throw new BuildException(\n" + |
6865 |
" throw new BuildException(\n" + |
| 7026 |
" MessageFormat\n" + |
6866 |
" MessageFormat\n" + |
| 7027 |
" .format(InternalAntMessages\n" + |
6867 |
" .format(InternalAntMessages\n" + |
| 7028 |
" .getString(\"InternalAntRunner.Buildfile__{0}_is_not_a_file_1\"), //$NON-NLS-1$\n" + |
6868 |
" .getString(\"InternalAntRunner.Buildfile__{0}_is_not_a_file_1\"), //$NON-NLS-1$\n" + |
| 7029 |
" new String[] { buildFile.getAbsolutePath() }));\n" + |
6869 |
" new String[] { buildFile.getAbsolutePath() }));\n" + |
| 7030 |
" }\n" + |
6870 |
" }\n" + |
| 7031 |
" }\n" + |
6871 |
" }\n" + |
| 7032 |
"}\n" |
6872 |
"}\n" |
|
Lines 7630-7635
Link Here
|
| 7630 |
} |
7470 |
} |
| 7631 |
|
7471 |
|
| 7632 |
/** |
7472 |
/** |
|
|
7473 |
* @bug 330313: [formatter] 'Never join already wrapped lines' formatter option does correctly indent |
| 7474 |
* @test Ensure that indentation is correct when 'Never join already wrapped lines' is set |
| 7475 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=330313" |
| 7476 |
*/ |
| 7477 |
public void testBug330313() { |
| 7478 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7479 |
String source = |
| 7480 |
"public class Test {\n" + |
| 7481 |
" private void helper2(\n" + |
| 7482 |
" boolean[] booleans) {\n" + |
| 7483 |
" if (booleans[0]) {\n" + |
| 7484 |
"\n" + |
| 7485 |
" }\n" + |
| 7486 |
" }\n" + |
| 7487 |
"}\n"; |
| 7488 |
formatSource(source, |
| 7489 |
"public class Test {\n" + |
| 7490 |
" private void helper2(\n" + |
| 7491 |
" boolean[] booleans) {\n" + |
| 7492 |
" if (booleans[0]) {\n" + |
| 7493 |
"\n" + |
| 7494 |
" }\n" + |
| 7495 |
" }\n" + |
| 7496 |
"}\n" |
| 7497 |
); |
| 7498 |
} |
| 7499 |
public void testBug330313a() { |
| 7500 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7501 |
String source = |
| 7502 |
"public class Test {\n" + |
| 7503 |
" private void helper2(\n" + |
| 7504 |
" boolean[] booleans) {\n" + |
| 7505 |
" if (booleans[0]) {\n" + |
| 7506 |
"\n" + |
| 7507 |
" }\n" + |
| 7508 |
" }\n" + |
| 7509 |
"}\n"; |
| 7510 |
formatSource(source); |
| 7511 |
} |
| 7512 |
public void testBug330313b() { |
| 7513 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7514 |
String source = |
| 7515 |
"public class Test {\n" + |
| 7516 |
" private void helper2(\n" + |
| 7517 |
" boolean[] booleans) {\n" + |
| 7518 |
" if (booleans[0]) {\n" + |
| 7519 |
"\n" + |
| 7520 |
" }\n" + |
| 7521 |
" }\n" + |
| 7522 |
"}\n"; |
| 7523 |
formatSource(source, |
| 7524 |
"public class Test {\n" + |
| 7525 |
" private void helper2(\n" + |
| 7526 |
" boolean[] booleans) {\n" + |
| 7527 |
" if (booleans[0]) {\n" + |
| 7528 |
"\n" + |
| 7529 |
" }\n" + |
| 7530 |
" }\n" + |
| 7531 |
"}\n" |
| 7532 |
); |
| 7533 |
} |
| 7534 |
public void testBug330313c() { |
| 7535 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7536 |
String source = |
| 7537 |
"public class Test {\n" + |
| 7538 |
" private void helper2(\n" + |
| 7539 |
"boolean[] booleans) {\n" + |
| 7540 |
" if (booleans[0]) {\n" + |
| 7541 |
"\n" + |
| 7542 |
" }\n" + |
| 7543 |
" }\n" + |
| 7544 |
"}\n"; |
| 7545 |
formatSource(source, |
| 7546 |
"public class Test {\n" + |
| 7547 |
" private void helper2(\n" + |
| 7548 |
" boolean[] booleans) {\n" + |
| 7549 |
" if (booleans[0]) {\n" + |
| 7550 |
"\n" + |
| 7551 |
" }\n" + |
| 7552 |
" }\n" + |
| 7553 |
"}\n" |
| 7554 |
); |
| 7555 |
} |
| 7556 |
public void testBug330313d() { |
| 7557 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7558 |
String source = |
| 7559 |
"public class Test {\n" + |
| 7560 |
" private void helper2(\n" + |
| 7561 |
" boolean[] booleans) {\n" + |
| 7562 |
" if (booleans[0]) {\n" + |
| 7563 |
"\n" + |
| 7564 |
" }\n" + |
| 7565 |
" }\n" + |
| 7566 |
"}\n"; |
| 7567 |
formatSource(source, |
| 7568 |
"public class Test {\n" + |
| 7569 |
" private void helper2(\n" + |
| 7570 |
" boolean[] booleans) {\n" + |
| 7571 |
" if (booleans[0]) {\n" + |
| 7572 |
"\n" + |
| 7573 |
" }\n" + |
| 7574 |
" }\n" + |
| 7575 |
"}\n" |
| 7576 |
); |
| 7577 |
} |
| 7578 |
public void testBug330313_regression_187a() { |
| 7579 |
String source = |
| 7580 |
"import java.io.File;\n" + |
| 7581 |
"\n" + |
| 7582 |
"public class RegressionTest_187 {\n" + |
| 7583 |
"\n" + |
| 7584 |
" private String createC42PDFCommandLine(String documentName) {\n" + |
| 7585 |
" return (Registry.getConvertToolPath() + File.separator +\n" + |
| 7586 |
" Registry.getConvertToolName() +\n" + |
| 7587 |
" \" -o \" + _workingDir + File.separator + documentName +\n" + |
| 7588 |
" \" -l \" + _workingDir + File.separator + _fileList);\n" + |
| 7589 |
" }\n" + |
| 7590 |
"}\n"; |
| 7591 |
formatSource(source, |
| 7592 |
"import java.io.File;\n" + |
| 7593 |
"\n" + |
| 7594 |
"public class RegressionTest_187 {\n" + |
| 7595 |
"\n" + |
| 7596 |
" private String createC42PDFCommandLine(String documentName) {\n" + |
| 7597 |
" return (Registry.getConvertToolPath() + File.separator\n" + |
| 7598 |
" + Registry.getConvertToolName() + \" -o \" + _workingDir\n" + |
| 7599 |
" + File.separator + documentName + \" -l \" + _workingDir\n" + |
| 7600 |
" + File.separator + _fileList);\n" + |
| 7601 |
" }\n" + |
| 7602 |
"}\n" |
| 7603 |
); |
| 7604 |
} |
| 7605 |
public void testBug330313_regression_187b() { |
| 7606 |
String source = |
| 7607 |
"import java.io.File;\n" + |
| 7608 |
"\n" + |
| 7609 |
"public class RegressionTest_187 {\n" + |
| 7610 |
"\n" + |
| 7611 |
" private String createC42PDFCommandLine(String documentName) {\n" + |
| 7612 |
" return (Registry.getConvertToolPath() + File.separator +\n" + |
| 7613 |
" Registry.getConvertToolName() +\n" + |
| 7614 |
" (\" -o \" + _workingDir + File.separator + documentName +\n" + |
| 7615 |
" (\" -l \" + _workingDir + File.separator + _fileList)));\n" + |
| 7616 |
" }\n" + |
| 7617 |
"}\n"; |
| 7618 |
formatSource(source, |
| 7619 |
"import java.io.File;\n" + |
| 7620 |
"\n" + |
| 7621 |
"public class RegressionTest_187 {\n" + |
| 7622 |
"\n" + |
| 7623 |
" private String createC42PDFCommandLine(String documentName) {\n" + |
| 7624 |
" return (Registry.getConvertToolPath() + File.separator\n" + |
| 7625 |
" + Registry.getConvertToolName() + (\" -o \" + _workingDir\n" + |
| 7626 |
" + File.separator + documentName + (\" -l \" + _workingDir\n" + |
| 7627 |
" + File.separator + _fileList)));\n" + |
| 7628 |
" }\n" + |
| 7629 |
"}\n" |
| 7630 |
); |
| 7631 |
} |
| 7632 |
//static { TESTS_PREFIX = "testBug330313_wksp1"; } |
| 7633 |
public void testBug330313_wksp1_01_njl() { |
| 7634 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7635 |
String source = |
| 7636 |
"package wksp1;\n" + |
| 7637 |
"\n" + |
| 7638 |
"public class X01 {\n" + |
| 7639 |
"\n" + |
| 7640 |
" protected String getPrefixFromDocument(String aDocumentText, int anOffset) {\n" + |
| 7641 |
" int startOfWordToken = anOffset;\n" + |
| 7642 |
" \n" + |
| 7643 |
" char token= \'a\';\n" + |
| 7644 |
" if (startOfWordToken > 0) {\n" + |
| 7645 |
" token= aDocumentText.charAt(startOfWordToken - 1);\n" + |
| 7646 |
" }\n" + |
| 7647 |
" \n" + |
| 7648 |
" while (startOfWordToken > 0 \n" + |
| 7649 |
" && (Character.isJavaIdentifierPart(token) \n" + |
| 7650 |
" || \'.\' == token\n" + |
| 7651 |
" || \'-\' == token\n" + |
| 7652 |
" || \';\' == token)\n" + |
| 7653 |
" && !(\'$\' == token)) {\n" + |
| 7654 |
" startOfWordToken--;\n" + |
| 7655 |
" if (startOfWordToken == 0) {\n" + |
| 7656 |
" break; //word goes right to the beginning of the doc\n" + |
| 7657 |
" }\n" + |
| 7658 |
" token= aDocumentText.charAt(startOfWordToken - 1);\n" + |
| 7659 |
" }\n" + |
| 7660 |
" return \"\";\n" + |
| 7661 |
" }\n" + |
| 7662 |
"}\n"; |
| 7663 |
formatSource(source, |
| 7664 |
"package wksp1;\n" + |
| 7665 |
"\n" + |
| 7666 |
"public class X01 {\n" + |
| 7667 |
"\n" + |
| 7668 |
" protected String getPrefixFromDocument(String aDocumentText, int anOffset) {\n" + |
| 7669 |
" int startOfWordToken = anOffset;\n" + |
| 7670 |
"\n" + |
| 7671 |
" char token = \'a\';\n" + |
| 7672 |
" if (startOfWordToken > 0) {\n" + |
| 7673 |
" token = aDocumentText.charAt(startOfWordToken - 1);\n" + |
| 7674 |
" }\n" + |
| 7675 |
"\n" + |
| 7676 |
" while (startOfWordToken > 0\n" + |
| 7677 |
" && (Character.isJavaIdentifierPart(token)\n" + |
| 7678 |
" || \'.\' == token\n" + |
| 7679 |
" || \'-\' == token\n" + |
| 7680 |
" || \';\' == token)\n" + |
| 7681 |
" && !(\'$\' == token)) {\n" + |
| 7682 |
" startOfWordToken--;\n" + |
| 7683 |
" if (startOfWordToken == 0) {\n" + |
| 7684 |
" break; // word goes right to the beginning of the doc\n" + |
| 7685 |
" }\n" + |
| 7686 |
" token = aDocumentText.charAt(startOfWordToken - 1);\n" + |
| 7687 |
" }\n" + |
| 7688 |
" return \"\";\n" + |
| 7689 |
" }\n" + |
| 7690 |
"}\n" |
| 7691 |
); |
| 7692 |
} |
| 7693 |
public void testBug330313_wksp1_02_njl() { |
| 7694 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7695 |
String source = |
| 7696 |
"package wksp1;\n" + |
| 7697 |
"\n" + |
| 7698 |
"public class X02 {\n" + |
| 7699 |
" public void testMethod(String currentTokenVal,\n" + |
| 7700 |
" int[][] expectedTokenSequencesVal,\n" + |
| 7701 |
" String[] tokenImageVal\n" + |
| 7702 |
" )\n" + |
| 7703 |
" {\n" + |
| 7704 |
" }\n" + |
| 7705 |
"}\n"; |
| 7706 |
formatSource(source, |
| 7707 |
"package wksp1;\n" + |
| 7708 |
"\n" + |
| 7709 |
"public class X02 {\n" + |
| 7710 |
" public void testMethod(String currentTokenVal,\n" + |
| 7711 |
" int[][] expectedTokenSequencesVal,\n" + |
| 7712 |
" String[] tokenImageVal\n" + |
| 7713 |
" )\n" + |
| 7714 |
" {\n" + |
| 7715 |
" }\n" + |
| 7716 |
"}\n" |
| 7717 |
); |
| 7718 |
} |
| 7719 |
public void testBug330313_wksp1_03_njl() { |
| 7720 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7721 |
String source = |
| 7722 |
"package wksp1;\n" + |
| 7723 |
"\n" + |
| 7724 |
"public class X03 {\n" + |
| 7725 |
"\n" + |
| 7726 |
" void foo() {\n" + |
| 7727 |
" if (declaringClass.isNestedType()){\n" + |
| 7728 |
" NestedTypeBinding nestedType = (NestedTypeBinding) declaringClass;\n" + |
| 7729 |
" this.scope.extraSyntheticArguments = nestedType.syntheticOuterLocalVariables();\n" + |
| 7730 |
" scope.computeLocalVariablePositions(// consider synthetic arguments if any\n" + |
| 7731 |
" nestedType.enclosingInstancesSlotSize + 1,\n" + |
| 7732 |
" codeStream);\n" + |
| 7733 |
" argSlotSize += nestedType.enclosingInstancesSlotSize;\n" + |
| 7734 |
" argSlotSize += nestedType.outerLocalVariablesSlotSize;\n" + |
| 7735 |
" } else {\n" + |
| 7736 |
" scope.computeLocalVariablePositions(1, codeStream);\n" + |
| 7737 |
" }\n" + |
| 7738 |
" }\n" + |
| 7739 |
"}\n"; |
| 7740 |
formatSource(source, |
| 7741 |
"package wksp1;\n" + |
| 7742 |
"\n" + |
| 7743 |
"public class X03 {\n" + |
| 7744 |
"\n" + |
| 7745 |
" void foo() {\n" + |
| 7746 |
" if (declaringClass.isNestedType()) {\n" + |
| 7747 |
" NestedTypeBinding nestedType = (NestedTypeBinding) declaringClass;\n" + |
| 7748 |
" this.scope.extraSyntheticArguments = nestedType\n" + |
| 7749 |
" .syntheticOuterLocalVariables();\n" + |
| 7750 |
" scope.computeLocalVariablePositions(// consider synthetic arguments\n" + |
| 7751 |
" // if any\n" + |
| 7752 |
" nestedType.enclosingInstancesSlotSize + 1,\n" + |
| 7753 |
" codeStream);\n" + |
| 7754 |
" argSlotSize += nestedType.enclosingInstancesSlotSize;\n" + |
| 7755 |
" argSlotSize += nestedType.outerLocalVariablesSlotSize;\n" + |
| 7756 |
" } else {\n" + |
| 7757 |
" scope.computeLocalVariablePositions(1, codeStream);\n" + |
| 7758 |
" }\n" + |
| 7759 |
" }\n" + |
| 7760 |
"}\n" |
| 7761 |
); |
| 7762 |
} |
| 7763 |
public void testBug330313_wksp1_04() { |
| 7764 |
String source = |
| 7765 |
"package wksp1;\n" + |
| 7766 |
"\n" + |
| 7767 |
"public class X04 {\n" + |
| 7768 |
"\n" + |
| 7769 |
" void foo() {\n" + |
| 7770 |
" for (;;) {\n" + |
| 7771 |
" if (act <= NUM_RULES) { // reduce action\n" + |
| 7772 |
" tempStackTop--;\n" + |
| 7773 |
" } else if (act < ACCEPT_ACTION || // shift action\n" + |
| 7774 |
" act > ERROR_ACTION) { // shift-reduce action\n" + |
| 7775 |
" if (indx == MAX_DISTANCE)\n" + |
| 7776 |
" return indx;\n" + |
| 7777 |
" indx++;\n" + |
| 7778 |
" }\n" + |
| 7779 |
" }\n" + |
| 7780 |
" }\n" + |
| 7781 |
"}\n"; |
| 7782 |
formatSource(source, |
| 7783 |
"package wksp1;\n" + |
| 7784 |
"\n" + |
| 7785 |
"public class X04 {\n" + |
| 7786 |
"\n" + |
| 7787 |
" void foo() {\n" + |
| 7788 |
" for (;;) {\n" + |
| 7789 |
" if (act <= NUM_RULES) { // reduce action\n" + |
| 7790 |
" tempStackTop--;\n" + |
| 7791 |
" } else if (act < ACCEPT_ACTION || // shift action\n" + |
| 7792 |
" act > ERROR_ACTION) { // shift-reduce action\n" + |
| 7793 |
" if (indx == MAX_DISTANCE)\n" + |
| 7794 |
" return indx;\n" + |
| 7795 |
" indx++;\n" + |
| 7796 |
" }\n" + |
| 7797 |
" }\n" + |
| 7798 |
" }\n" + |
| 7799 |
"}\n" |
| 7800 |
); |
| 7801 |
} |
| 7802 |
public void testBug330313_wksp1_04_njl() { |
| 7803 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7804 |
String source = |
| 7805 |
"package wksp1;\n" + |
| 7806 |
"\n" + |
| 7807 |
"public class X04 {\n" + |
| 7808 |
"\n" + |
| 7809 |
" void foo() {\n" + |
| 7810 |
" for (;;) {\n" + |
| 7811 |
" if (act <= NUM_RULES) { // reduce action\n" + |
| 7812 |
" tempStackTop--;\n" + |
| 7813 |
" } else if (act < ACCEPT_ACTION || // shift action\n" + |
| 7814 |
" act > ERROR_ACTION) { // shift-reduce action\n" + |
| 7815 |
" if (indx == MAX_DISTANCE)\n" + |
| 7816 |
" return indx;\n" + |
| 7817 |
" indx++;\n" + |
| 7818 |
" }\n" + |
| 7819 |
" }\n" + |
| 7820 |
" }\n" + |
| 7821 |
"}\n"; |
| 7822 |
formatSource(source, |
| 7823 |
"package wksp1;\n" + |
| 7824 |
"\n" + |
| 7825 |
"public class X04 {\n" + |
| 7826 |
"\n" + |
| 7827 |
" void foo() {\n" + |
| 7828 |
" for (;;) {\n" + |
| 7829 |
" if (act <= NUM_RULES) { // reduce action\n" + |
| 7830 |
" tempStackTop--;\n" + |
| 7831 |
" } else if (act < ACCEPT_ACTION || // shift action\n" + |
| 7832 |
" act > ERROR_ACTION) { // shift-reduce action\n" + |
| 7833 |
" if (indx == MAX_DISTANCE)\n" + |
| 7834 |
" return indx;\n" + |
| 7835 |
" indx++;\n" + |
| 7836 |
" }\n" + |
| 7837 |
" }\n" + |
| 7838 |
" }\n" + |
| 7839 |
"}\n" |
| 7840 |
); |
| 7841 |
} |
| 7842 |
public void testBug330313_wksp1_05_njl() { |
| 7843 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7844 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 7845 |
String source = |
| 7846 |
"package wksp1;\n" + |
| 7847 |
"\n" + |
| 7848 |
"public class X05 {\n" + |
| 7849 |
"\n" + |
| 7850 |
" private void foo() {\n" + |
| 7851 |
" setBuildFileLocation.invoke(runner, new Object[] { buildFileLocation });\n" + |
| 7852 |
" }\n" + |
| 7853 |
"}\n"; |
| 7854 |
formatSource(source, |
| 7855 |
"package wksp1;\n" + |
| 7856 |
"\n" + |
| 7857 |
"public class X05\n" + |
| 7858 |
"{\n" + |
| 7859 |
"\n" + |
| 7860 |
" private void foo()\n" + |
| 7861 |
" {\n" + |
| 7862 |
" setBuildFileLocation.invoke(runner, new Object[]\n" + |
| 7863 |
" { buildFileLocation });\n" + |
| 7864 |
" }\n" + |
| 7865 |
"}\n" |
| 7866 |
); |
| 7867 |
} |
| 7868 |
public void testBug330313_wksp1_06_njl() { |
| 7869 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7870 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 7871 |
String source = |
| 7872 |
"package wksp1;\n" + |
| 7873 |
"\n" + |
| 7874 |
"public class X06 {\n" + |
| 7875 |
"\n" + |
| 7876 |
" public void foo(Object index) {\n" + |
| 7877 |
"\n" + |
| 7878 |
" try {\n" + |
| 7879 |
" index = this.manager.getIndexForUpdate(this.containerPath, true, /*reuse index file*/ true /*create if none*/);\n" + |
| 7880 |
" }\n" + |
| 7881 |
" finally {}\n" + |
| 7882 |
" }\n" + |
| 7883 |
"}\n"; |
| 7884 |
formatSource(source, |
| 7885 |
"package wksp1;\n" + |
| 7886 |
"\n" + |
| 7887 |
"public class X06\n" + |
| 7888 |
"{\n" + |
| 7889 |
"\n" + |
| 7890 |
" public void foo(Object index)\n" + |
| 7891 |
" {\n" + |
| 7892 |
"\n" + |
| 7893 |
" try\n" + |
| 7894 |
" {\n" + |
| 7895 |
" index = this.manager.getIndexForUpdate(this.containerPath, true, /*\n" + |
| 7896 |
" * reuse\n" + |
| 7897 |
" * index\n" + |
| 7898 |
" * file\n" + |
| 7899 |
" */\n" + |
| 7900 |
" true /* create if none */);\n" + |
| 7901 |
" } finally\n" + |
| 7902 |
" {\n" + |
| 7903 |
" }\n" + |
| 7904 |
" }\n" + |
| 7905 |
"}\n" |
| 7906 |
); |
| 7907 |
} |
| 7908 |
public void testBug330313_wksp1_07() { |
| 7909 |
String source = |
| 7910 |
"package wksp1;\n" + |
| 7911 |
"\n" + |
| 7912 |
"public class X07 {\n" + |
| 7913 |
"\n" + |
| 7914 |
"static final long[] jjtoToken = {\n" + |
| 7915 |
" 0x7fbfecffL, \n" + |
| 7916 |
"};\n" + |
| 7917 |
"static final long[] jjtoSkip = {\n" + |
| 7918 |
" 0x400000L, \n" + |
| 7919 |
"};\n" + |
| 7920 |
"\n" + |
| 7921 |
"}\n"; |
| 7922 |
formatSource(source, |
| 7923 |
"package wksp1;\n" + |
| 7924 |
"\n" + |
| 7925 |
"public class X07 {\n" + |
| 7926 |
"\n" + |
| 7927 |
" static final long[] jjtoToken = { 0x7fbfecffL, };\n" + |
| 7928 |
" static final long[] jjtoSkip = { 0x400000L, };\n" + |
| 7929 |
"\n" + |
| 7930 |
"}\n" |
| 7931 |
); |
| 7932 |
} |
| 7933 |
public void testBug330313_wksp1_07_bnl() { |
| 7934 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 7935 |
String source = |
| 7936 |
"package wksp1;\n" + |
| 7937 |
"\n" + |
| 7938 |
"public class X07 {\n" + |
| 7939 |
"\n" + |
| 7940 |
"static final long[] jjtoToken = {\n" + |
| 7941 |
" 0x7fbfecffL, \n" + |
| 7942 |
"};\n" + |
| 7943 |
"static final long[] jjtoSkip = {\n" + |
| 7944 |
" 0x400000L, \n" + |
| 7945 |
"};\n" + |
| 7946 |
"\n" + |
| 7947 |
"}\n"; |
| 7948 |
formatSource(source, |
| 7949 |
"package wksp1;\n" + |
| 7950 |
"\n" + |
| 7951 |
"public class X07\n" + |
| 7952 |
"{\n" + |
| 7953 |
"\n" + |
| 7954 |
" static final long[] jjtoToken =\n" + |
| 7955 |
" { 0x7fbfecffL, };\n" + |
| 7956 |
" static final long[] jjtoSkip =\n" + |
| 7957 |
" { 0x400000L, };\n" + |
| 7958 |
"\n" + |
| 7959 |
"}\n" |
| 7960 |
); |
| 7961 |
} |
| 7962 |
public void testBug330313_wksp1_07_njl() { |
| 7963 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7964 |
String source = |
| 7965 |
"package wksp1;\n" + |
| 7966 |
"\n" + |
| 7967 |
"public class X07 {\n" + |
| 7968 |
"\n" + |
| 7969 |
"static final long[] jjtoToken = {\n" + |
| 7970 |
" 0x7fbfecffL, \n" + |
| 7971 |
"};\n" + |
| 7972 |
"static final long[] jjtoSkip = {\n" + |
| 7973 |
" 0x400000L, \n" + |
| 7974 |
"};\n" + |
| 7975 |
"\n" + |
| 7976 |
"}\n"; |
| 7977 |
formatSource(source, |
| 7978 |
"package wksp1;\n" + |
| 7979 |
"\n" + |
| 7980 |
"public class X07 {\n" + |
| 7981 |
"\n" + |
| 7982 |
" static final long[] jjtoToken = {\n" + |
| 7983 |
" 0x7fbfecffL,\n" + |
| 7984 |
" };\n" + |
| 7985 |
" static final long[] jjtoSkip = {\n" + |
| 7986 |
" 0x400000L,\n" + |
| 7987 |
" };\n" + |
| 7988 |
"\n" + |
| 7989 |
"}\n" |
| 7990 |
); |
| 7991 |
} |
| 7992 |
public void testBug330313_wksp1_07_njl_bnl() { |
| 7993 |
this.formatterPrefs.join_wrapped_lines = false; |
| 7994 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 7995 |
String source = |
| 7996 |
"package wksp1;\n" + |
| 7997 |
"\n" + |
| 7998 |
"public class X07 {\n" + |
| 7999 |
"\n" + |
| 8000 |
"static final long[] jjtoToken = {\n" + |
| 8001 |
" 0x7fbfecffL, \n" + |
| 8002 |
"};\n" + |
| 8003 |
"static final long[] jjtoSkip = {\n" + |
| 8004 |
" 0x400000L, \n" + |
| 8005 |
"};\n" + |
| 8006 |
"\n" + |
| 8007 |
"}\n"; |
| 8008 |
formatSource(source, |
| 8009 |
"package wksp1;\n" + |
| 8010 |
"\n" + |
| 8011 |
"public class X07\n" + |
| 8012 |
"{\n" + |
| 8013 |
"\n" + |
| 8014 |
" static final long[] jjtoToken =\n" + |
| 8015 |
" {\n" + |
| 8016 |
" 0x7fbfecffL,\n" + |
| 8017 |
" };\n" + |
| 8018 |
" static final long[] jjtoSkip =\n" + |
| 8019 |
" {\n" + |
| 8020 |
" 0x400000L,\n" + |
| 8021 |
" };\n" + |
| 8022 |
"\n" + |
| 8023 |
"}\n" |
| 8024 |
); |
| 8025 |
} |
| 8026 |
public void testBug330313_wksp1_08_njl() { |
| 8027 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8028 |
String source = |
| 8029 |
"package wksp1;\n" + |
| 8030 |
"\n" + |
| 8031 |
"public class X08 {\n" + |
| 8032 |
"\n" + |
| 8033 |
" void foo() {\n" + |
| 8034 |
" MinimizedFileSystemElement dummyParent =\n" + |
| 8035 |
" new MinimizedFileSystemElement(\"\", null, true);//$NON-NLS-1$\n" + |
| 8036 |
" }\n" + |
| 8037 |
"}\n"; |
| 8038 |
formatSource(source, |
| 8039 |
"package wksp1;\n" + |
| 8040 |
"\n" + |
| 8041 |
"public class X08 {\n" + |
| 8042 |
"\n" + |
| 8043 |
" void foo() {\n" + |
| 8044 |
" MinimizedFileSystemElement dummyParent =\n" + |
| 8045 |
" new MinimizedFileSystemElement(\"\", null, true);//$NON-NLS-1$\n" + |
| 8046 |
" }\n" + |
| 8047 |
"}\n" |
| 8048 |
); |
| 8049 |
} |
| 8050 |
// testCompare1159_1: org.eclipse.debug.internal.ui.DebugUIPropertiesAdapterFactory |
| 8051 |
public void testBug330313_wksp1_09_njl() { |
| 8052 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8053 |
String source = |
| 8054 |
"package wksp1;\n" + |
| 8055 |
"\n" + |
| 8056 |
"public class X09 {\n" + |
| 8057 |
" public Class[] getAdapterList() {\n" + |
| 8058 |
" return new Class[] {\n" + |
| 8059 |
" IWorkbenchAdapter.class\n" + |
| 8060 |
" };\n" + |
| 8061 |
" }\n" + |
| 8062 |
"}\n"; |
| 8063 |
formatSource(source, |
| 8064 |
"package wksp1;\n" + |
| 8065 |
"\n" + |
| 8066 |
"public class X09 {\n" + |
| 8067 |
" public Class[] getAdapterList() {\n" + |
| 8068 |
" return new Class[] {\n" + |
| 8069 |
" IWorkbenchAdapter.class\n" + |
| 8070 |
" };\n" + |
| 8071 |
" }\n" + |
| 8072 |
"}\n" |
| 8073 |
); |
| 8074 |
} |
| 8075 |
// testCompare1723_1: org.eclipse.jdt.internal.compiler.ast.DoubleLiteral |
| 8076 |
public void testBug330313_wksp1_10_njl() { |
| 8077 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8078 |
String source = |
| 8079 |
"package wksp1;\n" + |
| 8080 |
"\n" + |
| 8081 |
"public class X10 {\n" + |
| 8082 |
"\n" + |
| 8083 |
"public void computeConstant() {\n" + |
| 8084 |
"\n" + |
| 8085 |
" if (true)\n" + |
| 8086 |
" { //only a true 0 can be made of zeros\n" + |
| 8087 |
" //2.00000000000000000e-324 is illegal .... \n" + |
| 8088 |
" }}\n" + |
| 8089 |
"}\n"; |
| 8090 |
formatSource(source, |
| 8091 |
"package wksp1;\n" + |
| 8092 |
"\n" + |
| 8093 |
"public class X10 {\n" + |
| 8094 |
"\n" + |
| 8095 |
" public void computeConstant() {\n" + |
| 8096 |
"\n" + |
| 8097 |
" if (true)\n" + |
| 8098 |
" { // only a true 0 can be made of zeros\n" + |
| 8099 |
" // 2.00000000000000000e-324 is illegal ....\n" + |
| 8100 |
" }\n" + |
| 8101 |
" }\n" + |
| 8102 |
"}\n" |
| 8103 |
); |
| 8104 |
} |
| 8105 |
// testCompare1794_1: org.eclipse.jdt.internal.compiler.ast.ClassFile |
| 8106 |
public void testBug330313_wksp1_11_njl() { |
| 8107 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8108 |
String source = |
| 8109 |
"package wksp1;\n" + |
| 8110 |
"\n" + |
| 8111 |
"public class X11 {\n" + |
| 8112 |
" X11() {\n" + |
| 8113 |
" accessFlags\n" + |
| 8114 |
" &= ~(\n" + |
| 8115 |
" AccStrictfp\n" + |
| 8116 |
" | AccProtected\n" + |
| 8117 |
" | AccPrivate\n" + |
| 8118 |
" | AccStatic\n" + |
| 8119 |
" | AccSynchronized\n" + |
| 8120 |
" | AccNative);\n" + |
| 8121 |
" }\n" + |
| 8122 |
"}\n"; |
| 8123 |
formatSource(source, |
| 8124 |
"package wksp1;\n" + |
| 8125 |
"\n" + |
| 8126 |
"public class X11 {\n" + |
| 8127 |
" X11() {\n" + |
| 8128 |
" accessFlags &= ~(\n" + |
| 8129 |
" AccStrictfp\n" + |
| 8130 |
" | AccProtected\n" + |
| 8131 |
" | AccPrivate\n" + |
| 8132 |
" | AccStatic\n" + |
| 8133 |
" | AccSynchronized\n" + |
| 8134 |
" | AccNative);\n" + |
| 8135 |
" }\n" + |
| 8136 |
"}\n" |
| 8137 |
); |
| 8138 |
} |
| 8139 |
// rg.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/formatter/XmlFormatter.java |
| 8140 |
public void testBug330313_wksp1_12() { |
| 8141 |
String source = |
| 8142 |
"package wksp1;\n" + |
| 8143 |
"\n" + |
| 8144 |
"public class X12 {\n" + |
| 8145 |
"\n" + |
| 8146 |
" private static Document createDocument(String string, Position[] positions) throws IllegalArgumentException {\n" + |
| 8147 |
" Document doc= new Document(string);\n" + |
| 8148 |
" try {\n" + |
| 8149 |
" if (positions != null) {\n" + |
| 8150 |
" doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) {\n" + |
| 8151 |
" protected boolean notDeleted() {\n" + |
| 8152 |
" if (fOffset < fPosition.offset && (fPosition.offset + fPosition.length < fOffset + fLength)) {\n" + |
| 8153 |
" return false;\n" + |
| 8154 |
" }\n" + |
| 8155 |
" return true;\n" + |
| 8156 |
" }\n" + |
| 8157 |
" });\n" + |
| 8158 |
" }\n" + |
| 8159 |
" } catch (BadPositionCategoryException cannotHappen) {\n" + |
| 8160 |
" // can not happen: category is correctly set up\n" + |
| 8161 |
" }\n" + |
| 8162 |
" return doc;\n" + |
| 8163 |
" }\n" + |
| 8164 |
"}\n"; |
| 8165 |
formatSource(source, |
| 8166 |
"package wksp1;\n" + |
| 8167 |
"\n" + |
| 8168 |
"public class X12 {\n" + |
| 8169 |
"\n" + |
| 8170 |
" private static Document createDocument(String string, Position[] positions)\n" + |
| 8171 |
" throws IllegalArgumentException {\n" + |
| 8172 |
" Document doc = new Document(string);\n" + |
| 8173 |
" try {\n" + |
| 8174 |
" if (positions != null) {\n" + |
| 8175 |
" doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) {\n" + |
| 8176 |
" protected boolean notDeleted() {\n" + |
| 8177 |
" if (fOffset < fPosition.offset\n" + |
| 8178 |
" && (fPosition.offset + fPosition.length < fOffset\n" + |
| 8179 |
" + fLength)) {\n" + |
| 8180 |
" return false;\n" + |
| 8181 |
" }\n" + |
| 8182 |
" return true;\n" + |
| 8183 |
" }\n" + |
| 8184 |
" });\n" + |
| 8185 |
" }\n" + |
| 8186 |
" } catch (BadPositionCategoryException cannotHappen) {\n" + |
| 8187 |
" // can not happen: category is correctly set up\n" + |
| 8188 |
" }\n" + |
| 8189 |
" return doc;\n" + |
| 8190 |
" }\n" + |
| 8191 |
"}\n" |
| 8192 |
); |
| 8193 |
} |
| 8194 |
public void testBug330313_wksp1_12_njl() { |
| 8195 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8196 |
String source = |
| 8197 |
"package wksp1;\n" + |
| 8198 |
"\n" + |
| 8199 |
"public class X12 {\n" + |
| 8200 |
"\n" + |
| 8201 |
" private static Document createDocument(String string, Position[] positions) throws IllegalArgumentException {\n" + |
| 8202 |
" Document doc= new Document(string);\n" + |
| 8203 |
" try {\n" + |
| 8204 |
" if (positions != null) {\n" + |
| 8205 |
" doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) {\n" + |
| 8206 |
" protected boolean notDeleted() {\n" + |
| 8207 |
" if (fOffset < fPosition.offset && (fPosition.offset + fPosition.length < fOffset + fLength)) {\n" + |
| 8208 |
" return false;\n" + |
| 8209 |
" }\n" + |
| 8210 |
" return true;\n" + |
| 8211 |
" }\n" + |
| 8212 |
" });\n" + |
| 8213 |
" }\n" + |
| 8214 |
" } catch (BadPositionCategoryException cannotHappen) {\n" + |
| 8215 |
" // can not happen: category is correctly set up\n" + |
| 8216 |
" }\n" + |
| 8217 |
" return doc;\n" + |
| 8218 |
" }\n" + |
| 8219 |
"}\n"; |
| 8220 |
formatSource(source, |
| 8221 |
"package wksp1;\n" + |
| 8222 |
"\n" + |
| 8223 |
"public class X12 {\n" + |
| 8224 |
"\n" + |
| 8225 |
" private static Document createDocument(String string, Position[] positions)\n" + |
| 8226 |
" throws IllegalArgumentException {\n" + |
| 8227 |
" Document doc = new Document(string);\n" + |
| 8228 |
" try {\n" + |
| 8229 |
" if (positions != null) {\n" + |
| 8230 |
" doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) {\n" + |
| 8231 |
" protected boolean notDeleted() {\n" + |
| 8232 |
" if (fOffset < fPosition.offset\n" + |
| 8233 |
" && (fPosition.offset + fPosition.length < fOffset\n" + |
| 8234 |
" + fLength)) {\n" + |
| 8235 |
" return false;\n" + |
| 8236 |
" }\n" + |
| 8237 |
" return true;\n" + |
| 8238 |
" }\n" + |
| 8239 |
" });\n" + |
| 8240 |
" }\n" + |
| 8241 |
" } catch (BadPositionCategoryException cannotHappen) {\n" + |
| 8242 |
" // can not happen: category is correctly set up\n" + |
| 8243 |
" }\n" + |
| 8244 |
" return doc;\n" + |
| 8245 |
" }\n" + |
| 8246 |
"}\n" |
| 8247 |
); |
| 8248 |
} |
| 8249 |
// Test case extracted from org.eclipse.ant.ui/org/eclipse/core/internal/dtree/NodeInfo.java |
| 8250 |
public void testBug330313_wksp1_13() { |
| 8251 |
String source = |
| 8252 |
"package wksp1;\n" + |
| 8253 |
"\n" + |
| 8254 |
"public class X13 {\n" + |
| 8255 |
"\n" + |
| 8256 |
" public boolean isEmptyDelta() {\n" + |
| 8257 |
" return (this.getType() == AbstractDataTreeNode.T_NO_DATA_DELTA_NODE && this.getNamesOfChildren().length == 0 && this.getNamesOfDeletedChildren().length == 0);\n" + |
| 8258 |
" }\n" + |
| 8259 |
"}\n"; |
| 8260 |
formatSource(source, |
| 8261 |
"package wksp1;\n" + |
| 8262 |
"\n" + |
| 8263 |
"public class X13 {\n" + |
| 8264 |
"\n" + |
| 8265 |
" public boolean isEmptyDelta() {\n" + |
| 8266 |
" return (this.getType() == AbstractDataTreeNode.T_NO_DATA_DELTA_NODE\n" + |
| 8267 |
" && this.getNamesOfChildren().length == 0 && this\n" + |
| 8268 |
" .getNamesOfDeletedChildren().length == 0);\n" + |
| 8269 |
" }\n" + |
| 8270 |
"}\n" |
| 8271 |
); |
| 8272 |
} |
| 8273 |
public void testBug330313_wksp1_13_njl() { |
| 8274 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8275 |
String source = |
| 8276 |
"package wksp1;\n" + |
| 8277 |
"\n" + |
| 8278 |
"public class X13 {\n" + |
| 8279 |
"\n" + |
| 8280 |
" public boolean isEmptyDelta() {\n" + |
| 8281 |
" return (this.getType() == AbstractDataTreeNode.T_NO_DATA_DELTA_NODE && this.getNamesOfChildren().length == 0 && this.getNamesOfDeletedChildren().length == 0);\n" + |
| 8282 |
" }\n" + |
| 8283 |
"}\n"; |
| 8284 |
formatSource(source, |
| 8285 |
"package wksp1;\n" + |
| 8286 |
"\n" + |
| 8287 |
"public class X13 {\n" + |
| 8288 |
"\n" + |
| 8289 |
" public boolean isEmptyDelta() {\n" + |
| 8290 |
" return (this.getType() == AbstractDataTreeNode.T_NO_DATA_DELTA_NODE\n" + |
| 8291 |
" && this.getNamesOfChildren().length == 0 && this\n" + |
| 8292 |
" .getNamesOfDeletedChildren().length == 0);\n" + |
| 8293 |
" }\n" + |
| 8294 |
"}\n" |
| 8295 |
); |
| 8296 |
} |
| 8297 |
// Test case extracted from org.eclipse.jdt.core/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java |
| 8298 |
public void testBug330313_wksp1_14() { |
| 8299 |
String source = |
| 8300 |
"package wksp1;\n" + |
| 8301 |
"\n" + |
| 8302 |
"public class X14 {\n" + |
| 8303 |
" public void foo() {\n" + |
| 8304 |
" if (true) {\n" + |
| 8305 |
" if (((bits & DepthMASK) != 0)\n" + |
| 8306 |
" && (fieldBinding.isPrivate() // private access\n" + |
| 8307 |
" || (fieldBinding.isProtected() // implicit protected access\n" + |
| 8308 |
" && fieldBinding.declaringClass.getPackage() \n" + |
| 8309 |
" != currentScope.enclosingSourceType().getPackage()))) {\n" + |
| 8310 |
" return;\n" + |
| 8311 |
" }\n" + |
| 8312 |
" }\n" + |
| 8313 |
" }\n" + |
| 8314 |
"}\n"; |
| 8315 |
formatSource(source, |
| 8316 |
"package wksp1;\n" + |
| 8317 |
"\n" + |
| 8318 |
"public class X14 {\n" + |
| 8319 |
" public void foo() {\n" + |
| 8320 |
" if (true) {\n" + |
| 8321 |
" if (((bits & DepthMASK) != 0) && (fieldBinding.isPrivate() // private\n" + |
| 8322 |
" // access\n" + |
| 8323 |
" || (fieldBinding.isProtected() // implicit protected access\n" + |
| 8324 |
" && fieldBinding.declaringClass.getPackage() != currentScope\n" + |
| 8325 |
" .enclosingSourceType().getPackage()))) {\n" + |
| 8326 |
" return;\n" + |
| 8327 |
" }\n" + |
| 8328 |
" }\n" + |
| 8329 |
" }\n" + |
| 8330 |
"}\n" |
| 8331 |
); |
| 8332 |
} |
| 8333 |
public void testBug330313_wksp1_14_njl() { |
| 8334 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8335 |
String source = |
| 8336 |
"package wksp1;\n" + |
| 8337 |
"\n" + |
| 8338 |
"public class X14 {\n" + |
| 8339 |
" public void foo() {\n" + |
| 8340 |
" if (true) {\n" + |
| 8341 |
" if (((bits & DepthMASK) != 0)\n" + |
| 8342 |
" && (fieldBinding.isPrivate() // private access\n" + |
| 8343 |
" || (fieldBinding.isProtected() // implicit protected access\n" + |
| 8344 |
" && fieldBinding.declaringClass.getPackage() \n" + |
| 8345 |
" != currentScope.enclosingSourceType().getPackage()))) {\n" + |
| 8346 |
" return;\n" + |
| 8347 |
" }\n" + |
| 8348 |
" }\n" + |
| 8349 |
" }\n" + |
| 8350 |
"}\n"; |
| 8351 |
formatSource(source, |
| 8352 |
"package wksp1;\n" + |
| 8353 |
"\n" + |
| 8354 |
"public class X14 {\n" + |
| 8355 |
" public void foo() {\n" + |
| 8356 |
" if (true) {\n" + |
| 8357 |
" if (((bits & DepthMASK) != 0)\n" + |
| 8358 |
" && (fieldBinding.isPrivate() // private access\n" + |
| 8359 |
" || (fieldBinding.isProtected() // implicit protected access\n" + |
| 8360 |
" && fieldBinding.declaringClass.getPackage()\n" + |
| 8361 |
" != currentScope.enclosingSourceType().getPackage()))) {\n" + |
| 8362 |
" return;\n" + |
| 8363 |
" }\n" + |
| 8364 |
" }\n" + |
| 8365 |
" }\n" + |
| 8366 |
"}\n" |
| 8367 |
); |
| 8368 |
} |
| 8369 |
// Test case extracted from org.eclipse.jdt.core/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java |
| 8370 |
public void testBug330313_wksp1_15_njl() { |
| 8371 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8372 |
String source = |
| 8373 |
"package wksp1;\n" + |
| 8374 |
"\n" + |
| 8375 |
"public class X15 {\n" + |
| 8376 |
" public void foo() {\n" + |
| 8377 |
" if (true) {\n" + |
| 8378 |
" if (fieldBinding.declaringClass != this.actualReceiverType\n" + |
| 8379 |
" && !this.actualReceiverType.isArrayType() \n" + |
| 8380 |
" && fieldBinding.declaringClass != null\n" + |
| 8381 |
" && fieldBinding.constant == NotAConstant\n" + |
| 8382 |
" && ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2 \n" + |
| 8383 |
" && !fieldBinding.isStatic()\n" + |
| 8384 |
" && fieldBinding.declaringClass.id != T_Object) // no change for Object fields (if there was any)\n" + |
| 8385 |
" || !fieldBinding.declaringClass.canBeSeenBy(currentScope))){\n" + |
| 8386 |
" this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)this.actualReceiverType);\n" + |
| 8387 |
" }\n" + |
| 8388 |
" }\n" + |
| 8389 |
" }\n" + |
| 8390 |
"}\n"; |
| 8391 |
formatSource(source, |
| 8392 |
"package wksp1;\n" + |
| 8393 |
"\n" + |
| 8394 |
"public class X15 {\n" + |
| 8395 |
" public void foo() {\n" + |
| 8396 |
" if (true) {\n" + |
| 8397 |
" if (fieldBinding.declaringClass != this.actualReceiverType\n" + |
| 8398 |
" && !this.actualReceiverType.isArrayType()\n" + |
| 8399 |
" && fieldBinding.declaringClass != null\n" + |
| 8400 |
" && fieldBinding.constant == NotAConstant\n" + |
| 8401 |
" && ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2\n" + |
| 8402 |
" && !fieldBinding.isStatic()\n" + |
| 8403 |
" && fieldBinding.declaringClass.id != T_Object) // no\n" + |
| 8404 |
" // change\n" + |
| 8405 |
" // for\n" + |
| 8406 |
" // Object\n" + |
| 8407 |
" // fields\n" + |
| 8408 |
" // (if\n" + |
| 8409 |
" // there\n" + |
| 8410 |
" // was\n" + |
| 8411 |
" // any)\n" + |
| 8412 |
" || !fieldBinding.declaringClass\n" + |
| 8413 |
" .canBeSeenBy(currentScope))) {\n" + |
| 8414 |
" this.codegenBinding = currentScope.enclosingSourceType()\n" + |
| 8415 |
" .getUpdatedFieldBinding(fieldBinding,\n" + |
| 8416 |
" (ReferenceBinding) this.actualReceiverType);\n" + |
| 8417 |
" }\n" + |
| 8418 |
" }\n" + |
| 8419 |
" }\n" + |
| 8420 |
"}\n" |
| 8421 |
); |
| 8422 |
} |
| 8423 |
// Test case 1941_1 (extracted from org.eclipse.jdt.core/org/eclipse/jdt/internal/compiler/ast/Parser.java) |
| 8424 |
public void testBug330313_wksp1_16() { |
| 8425 |
String source = |
| 8426 |
"package wksp1;\n" + |
| 8427 |
"\n" + |
| 8428 |
"public class X16 {\n" + |
| 8429 |
"void foo() {\n" + |
| 8430 |
" // recovery\n" + |
| 8431 |
" if (this.currentElement != null) {\n" + |
| 8432 |
" if (!(this.currentElement instanceof RecoveredType)\n" + |
| 8433 |
" && (this.currentToken == TokenNameDOT\n" + |
| 8434 |
" //|| declaration.modifiers != 0\n" + |
| 8435 |
" || (this.scanner.getLineNumber(declaration.type.sourceStart)\n" + |
| 8436 |
" != this.scanner.getLineNumber((int) (namePosition >>> 32))))){\n" + |
| 8437 |
" return;\n" + |
| 8438 |
" }\n" + |
| 8439 |
" }\n" + |
| 8440 |
"}\n" + |
| 8441 |
"}\n"; |
| 8442 |
formatSource(source, |
| 8443 |
"package wksp1;\n" + |
| 8444 |
"\n" + |
| 8445 |
"public class X16 {\n" + |
| 8446 |
" void foo() {\n" + |
| 8447 |
" // recovery\n" + |
| 8448 |
" if (this.currentElement != null) {\n" + |
| 8449 |
" if (!(this.currentElement instanceof RecoveredType)\n" + |
| 8450 |
" && (this.currentToken == TokenNameDOT\n" + |
| 8451 |
" // || declaration.modifiers != 0\n" + |
| 8452 |
" || (this.scanner\n" + |
| 8453 |
" .getLineNumber(declaration.type.sourceStart) != this.scanner\n" + |
| 8454 |
" .getLineNumber((int) (namePosition >>> 32))))) {\n" + |
| 8455 |
" return;\n" + |
| 8456 |
" }\n" + |
| 8457 |
" }\n" + |
| 8458 |
" }\n" + |
| 8459 |
"}\n" |
| 8460 |
); |
| 8461 |
} |
| 8462 |
public void testBug330313_wksp1_16_njl() { |
| 8463 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8464 |
String source = |
| 8465 |
"package wksp1;\n" + |
| 8466 |
"\n" + |
| 8467 |
"public class X16 {\n" + |
| 8468 |
"void foo() {\n" + |
| 8469 |
" // recovery\n" + |
| 8470 |
" if (this.currentElement != null) {\n" + |
| 8471 |
" if (!(this.currentElement instanceof RecoveredType)\n" + |
| 8472 |
" && (this.currentToken == TokenNameDOT\n" + |
| 8473 |
" //|| declaration.modifiers != 0\n" + |
| 8474 |
" || (this.scanner.getLineNumber(declaration.type.sourceStart)\n" + |
| 8475 |
" != this.scanner.getLineNumber((int) (namePosition >>> 32))))){\n" + |
| 8476 |
" return;\n" + |
| 8477 |
" }\n" + |
| 8478 |
" }\n" + |
| 8479 |
"}\n" + |
| 8480 |
"}\n"; |
| 8481 |
formatSource(source, |
| 8482 |
"package wksp1;\n" + |
| 8483 |
"\n" + |
| 8484 |
"public class X16 {\n" + |
| 8485 |
" void foo() {\n" + |
| 8486 |
" // recovery\n" + |
| 8487 |
" if (this.currentElement != null) {\n" + |
| 8488 |
" if (!(this.currentElement instanceof RecoveredType)\n" + |
| 8489 |
" && (this.currentToken == TokenNameDOT\n" + |
| 8490 |
" // || declaration.modifiers != 0\n" + |
| 8491 |
" || (this.scanner\n" + |
| 8492 |
" .getLineNumber(declaration.type.sourceStart)\n" + |
| 8493 |
" != this.scanner\n" + |
| 8494 |
" .getLineNumber((int) (namePosition >>> 32))))) {\n" + |
| 8495 |
" return;\n" + |
| 8496 |
" }\n" + |
| 8497 |
" }\n" + |
| 8498 |
" }\n" + |
| 8499 |
"}\n" |
| 8500 |
); |
| 8501 |
} |
| 8502 |
// Test case 1872_1 (extracted from org.eclipse.jdt.core/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java) |
| 8503 |
public void testBug330313_wksp1_17_njl() { |
| 8504 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8505 |
String source = |
| 8506 |
"package wksp1;\n" + |
| 8507 |
"\n" + |
| 8508 |
"public class X17 {\n" + |
| 8509 |
" void foo() {\n" + |
| 8510 |
" if ((currentMethodScope = this.methodScope())\n" + |
| 8511 |
" != outerLocalVariable.declaringScope.methodScope()) {\n" + |
| 8512 |
" return;\n" + |
| 8513 |
" }\n" + |
| 8514 |
" }\n" + |
| 8515 |
"}\n"; |
| 8516 |
formatSource(source , |
| 8517 |
"package wksp1;\n" + |
| 8518 |
"\n" + |
| 8519 |
"public class X17 {\n" + |
| 8520 |
" void foo() {\n" + |
| 8521 |
" if ((currentMethodScope = this.methodScope())\n" + |
| 8522 |
" != outerLocalVariable.declaringScope.methodScope()) {\n" + |
| 8523 |
" return;\n" + |
| 8524 |
" }\n" + |
| 8525 |
" }\n" + |
| 8526 |
"}\n" |
| 8527 |
); |
| 8528 |
} |
| 8529 |
// Test case 1964_1 (extracted from org.eclipse.jdt.core/org/eclipse/jdt/core/dom/ASTMatcher.java) |
| 8530 |
public void testBug330313_wksp1_18_njl() { |
| 8531 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8532 |
String source = |
| 8533 |
"package wksp1;\n" + |
| 8534 |
"\n" + |
| 8535 |
"public class X18 {\n" + |
| 8536 |
" public boolean foo() {\n" + |
| 8537 |
" return (\n" + |
| 8538 |
" safeSubtreeMatch(node.getJavadoc(), o.getJavadoc())\n" + |
| 8539 |
" && safeSubtreeListMatch(node.modifiers(), o.modifiers())\n" + |
| 8540 |
" && safeSubtreeMatch(node.getName(), o.getName())\n" + |
| 8541 |
" && safeSubtreeListMatch(node.arguments(), o.arguments())\n" + |
| 8542 |
" && safeSubtreeListMatch(\n" + |
| 8543 |
" node.bodyDeclarations(),\n" + |
| 8544 |
" o.bodyDeclarations()));\n" + |
| 8545 |
" }\n" + |
| 8546 |
"}\n"; |
| 8547 |
formatSource(source , |
| 8548 |
"package wksp1;\n" + |
| 8549 |
"\n" + |
| 8550 |
"public class X18 {\n" + |
| 8551 |
" public boolean foo() {\n" + |
| 8552 |
" return (safeSubtreeMatch(node.getJavadoc(), o.getJavadoc())\n" + |
| 8553 |
" && safeSubtreeListMatch(node.modifiers(), o.modifiers())\n" + |
| 8554 |
" && safeSubtreeMatch(node.getName(), o.getName())\n" + |
| 8555 |
" && safeSubtreeListMatch(node.arguments(), o.arguments())\n" + |
| 8556 |
" && safeSubtreeListMatch(\n" + |
| 8557 |
" node.bodyDeclarations(),\n" + |
| 8558 |
" o.bodyDeclarations()));\n" + |
| 8559 |
" }\n" + |
| 8560 |
"}\n" |
| 8561 |
); |
| 8562 |
} |
| 8563 |
public void testBug330313_wksp1_19_njl() { |
| 8564 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8565 |
String source = |
| 8566 |
"package wksp1;\n" + |
| 8567 |
"\n" + |
| 8568 |
"public class X19 {\n" + |
| 8569 |
" public boolean foo() {\n" + |
| 8570 |
" return (\n" + |
| 8571 |
" safeSubtreeMatch(node.getJavadoc(), o.getJavadoc())\n" + |
| 8572 |
" && safeSubtreeListMatch(node.modifiers(), o.modifiers())\n" + |
| 8573 |
" && safeSubtreeMatch(node.getName(), o.getName())\n" + |
| 8574 |
" && safeSubtreeListMatch(node.superInterfaceTypes(), o.superInterfaceTypes())\n" + |
| 8575 |
" && safeSubtreeListMatch(\n" + |
| 8576 |
" node.bodyDeclarations(),\n" + |
| 8577 |
" o.bodyDeclarations()));\n" + |
| 8578 |
" }\n" + |
| 8579 |
"}\n"; |
| 8580 |
formatSource(source , |
| 8581 |
"package wksp1;\n" + |
| 8582 |
"\n" + |
| 8583 |
"public class X19 {\n" + |
| 8584 |
" public boolean foo() {\n" + |
| 8585 |
" return (safeSubtreeMatch(node.getJavadoc(), o.getJavadoc())\n" + |
| 8586 |
" && safeSubtreeListMatch(node.modifiers(), o.modifiers())\n" + |
| 8587 |
" && safeSubtreeMatch(node.getName(), o.getName())\n" + |
| 8588 |
" && safeSubtreeListMatch(node.superInterfaceTypes(),\n" + |
| 8589 |
" o.superInterfaceTypes())\n" + |
| 8590 |
" && safeSubtreeListMatch(\n" + |
| 8591 |
" node.bodyDeclarations(),\n" + |
| 8592 |
" o.bodyDeclarations()));\n" + |
| 8593 |
" }\n" + |
| 8594 |
"}\n" |
| 8595 |
); |
| 8596 |
} |
| 8597 |
// Test case extracted from org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java |
| 8598 |
public void testBug330313_wksp1_20_njl() { |
| 8599 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8600 |
String source = |
| 8601 |
"package wksp1;\n" + |
| 8602 |
"\n" + |
| 8603 |
"public class X20 {\n" + |
| 8604 |
"\n" + |
| 8605 |
" static final String decode(String entity) {\n" + |
| 8606 |
" if (true) {\n" + |
| 8607 |
" if (entity.charAt(2) == \'X\' || entity.charAt(2) == \'x\') {\n" + |
| 8608 |
" }\n" + |
| 8609 |
" Character c =\n" + |
| 8610 |
" new Character((char)Integer.parseInt(entity.substring(start), radix));\n" + |
| 8611 |
" return c.toString();\n" + |
| 8612 |
" }\n" + |
| 8613 |
" return \"\";\n" + |
| 8614 |
" }\n" + |
| 8615 |
"}\n"; |
| 8616 |
formatSource(source , |
| 8617 |
"package wksp1;\n" + |
| 8618 |
"\n" + |
| 8619 |
"public class X20 {\n" + |
| 8620 |
"\n" + |
| 8621 |
" static final String decode(String entity) {\n" + |
| 8622 |
" if (true) {\n" + |
| 8623 |
" if (entity.charAt(2) == \'X\' || entity.charAt(2) == \'x\') {\n" + |
| 8624 |
" }\n" + |
| 8625 |
" Character c =\n" + |
| 8626 |
" new Character((char) Integer.parseInt(\n" + |
| 8627 |
" entity.substring(start), radix));\n" + |
| 8628 |
" return c.toString();\n" + |
| 8629 |
" }\n" + |
| 8630 |
" return \"\";\n" + |
| 8631 |
" }\n" + |
| 8632 |
"}\n" |
| 8633 |
); |
| 8634 |
} |
| 8635 |
// Test case extracted from org.apache.lucene/src/org/apache/lucene/demo/html/Entities.java |
| 8636 |
public void testBug330313_wksp1_21_njl() { |
| 8637 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8638 |
String source = |
| 8639 |
"package wksp1;\n" + |
| 8640 |
"\n" + |
| 8641 |
"public class X21 {\n" + |
| 8642 |
" public boolean isAvailable() {\n" + |
| 8643 |
" return !(getViewer() == null || getViewer().getControl() == null || getViewer().getControl().isDisposed());\n" + |
| 8644 |
" } \n" + |
| 8645 |
"}\n"; |
| 8646 |
formatSource(source , |
| 8647 |
"package wksp1;\n" + |
| 8648 |
"\n" + |
| 8649 |
"public class X21 {\n" + |
| 8650 |
" public boolean isAvailable() {\n" + |
| 8651 |
" return !(getViewer() == null || getViewer().getControl() == null || getViewer()\n" + |
| 8652 |
" .getControl().isDisposed());\n" + |
| 8653 |
" }\n" + |
| 8654 |
"}\n" |
| 8655 |
); |
| 8656 |
} |
| 8657 |
// Test case extracted from differences noticed with patch v27.txt |
| 8658 |
public void testBug330313_wksp1_22_njl() { |
| 8659 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8660 |
String source = |
| 8661 |
"package wksp1;\n" + |
| 8662 |
"\n" + |
| 8663 |
"public class X22 {\n" + |
| 8664 |
" public boolean foo() {\n" + |
| 8665 |
" return (\n" + |
| 8666 |
" (node.isInterface() == o.isInterface())\n" + |
| 8667 |
" && safeSubtreeMatch(node.getJavadoc(), o.getJavadoc())\n" + |
| 8668 |
" && safeSubtreeMatch(node.getName(), o.getName())\n" + |
| 8669 |
" && safeSubtreeListMatch(node.bodyDeclarations(), o.bodyDeclarations()));\n" + |
| 8670 |
" }\n" + |
| 8671 |
"}\n"; |
| 8672 |
formatSource(source , |
| 8673 |
"package wksp1;\n" + |
| 8674 |
"\n" + |
| 8675 |
"public class X22 {\n" + |
| 8676 |
" public boolean foo() {\n" + |
| 8677 |
" return ((node.isInterface() == o.isInterface())\n" + |
| 8678 |
" && safeSubtreeMatch(node.getJavadoc(), o.getJavadoc())\n" + |
| 8679 |
" && safeSubtreeMatch(node.getName(), o.getName())\n" + |
| 8680 |
" && safeSubtreeListMatch(node.bodyDeclarations(),\n" + |
| 8681 |
" o.bodyDeclarations()));\n" + |
| 8682 |
" }\n" + |
| 8683 |
"}\n" |
| 8684 |
); |
| 8685 |
} |
| 8686 |
public void testBug330313_wksp1_23_njl() { |
| 8687 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8688 |
String source = |
| 8689 |
"package wksp1;\n" + |
| 8690 |
"\n" + |
| 8691 |
"public class X23 {\n" + |
| 8692 |
" void foo() {\n" + |
| 8693 |
" boolean wasError = IMarker.SEVERITY_ERROR\n" + |
| 8694 |
" == pb.getAttribute(IMarker.SEVERITY,\n" + |
| 8695 |
" IMarker.SEVERITY_ERROR);\n" + |
| 8696 |
" }\n" + |
| 8697 |
"}\n"; |
| 8698 |
formatSource(source ); |
| 8699 |
} |
| 8700 |
public void testBug330313_wksp1_24_njl() { |
| 8701 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8702 |
String source = |
| 8703 |
"package wksp1;\n" + |
| 8704 |
"\n" + |
| 8705 |
"public class X24 {\n" + |
| 8706 |
"\n" + |
| 8707 |
" protected boolean canRunEvaluation() {\n" + |
| 8708 |
" // NOTE similar to #canStep, except a quiet suspend state is OK\n" + |
| 8709 |
" try {\n" + |
| 8710 |
" return isSuspendedQuiet() || (isSuspended()\n" + |
| 8711 |
" && !(isPerformingEvaluation() || isInvokingMethod())\n" + |
| 8712 |
" && !isStepping()\n" + |
| 8713 |
" && getTopStackFrame() != null\n" + |
| 8714 |
" && !getJavaDebugTarget().isPerformingHotCodeReplace());\n" + |
| 8715 |
" } catch (DebugException e) {\n" + |
| 8716 |
" return false;\n" + |
| 8717 |
" }\n" + |
| 8718 |
" }\n" + |
| 8719 |
"}\n"; |
| 8720 |
formatSource(source ); |
| 8721 |
} |
| 8722 |
public void testBug330313_wksp1_25_njl() { |
| 8723 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8724 |
String source = |
| 8725 |
"package wksp1;\n" + |
| 8726 |
"\n" + |
| 8727 |
"public class X25 {\n" + |
| 8728 |
"\n" + |
| 8729 |
" void unloadIcon(ImageData icon) {\n" + |
| 8730 |
" int sizeImage = (((icon.width * icon.depth + 31) / 32 * 4) +\n" + |
| 8731 |
" ((icon.width + 31) / 32 * 4)) * icon.height;\n" + |
| 8732 |
" }\n" + |
| 8733 |
"}\n"; |
| 8734 |
formatSource(source ); |
| 8735 |
} |
| 8736 |
public void testBug330313_wksp1_26_njl() { |
| 8737 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8738 |
String source = |
| 8739 |
"package wksp1;\n" + |
| 8740 |
"\n" + |
| 8741 |
"public class X26 {\n" + |
| 8742 |
"\n" + |
| 8743 |
"void foo() {\n" + |
| 8744 |
" for (int i = 0; i < data.length; i++) {\n" + |
| 8745 |
" byte s = data[i];\n" + |
| 8746 |
" sourceData[i] = (byte)(((s & 0x80) >> 7) |\n" + |
| 8747 |
" ((s & 0x40) >> 5) |\n" + |
| 8748 |
" ((s & 0x20) >> 3) |\n" + |
| 8749 |
" ((s & 0x10) >> 1) |\n" + |
| 8750 |
" ((s & 0x08) << 1) |\n" + |
| 8751 |
" ((s & 0x04) << 3) |\n" + |
| 8752 |
" ((s & 0x02) << 5) |\n" + |
| 8753 |
" ((s & 0x01) << 7));\n" + |
| 8754 |
" }\n" + |
| 8755 |
"}\n" + |
| 8756 |
"}\n"; |
| 8757 |
formatSource(source , |
| 8758 |
"package wksp1;\n" + |
| 8759 |
"\n" + |
| 8760 |
"public class X26 {\n" + |
| 8761 |
"\n" + |
| 8762 |
" void foo() {\n" + |
| 8763 |
" for (int i = 0; i < data.length; i++) {\n" + |
| 8764 |
" byte s = data[i];\n" + |
| 8765 |
" sourceData[i] = (byte) (((s & 0x80) >> 7) |\n" + |
| 8766 |
" ((s & 0x40) >> 5) |\n" + |
| 8767 |
" ((s & 0x20) >> 3) |\n" + |
| 8768 |
" ((s & 0x10) >> 1) |\n" + |
| 8769 |
" ((s & 0x08) << 1) |\n" + |
| 8770 |
" ((s & 0x04) << 3) |\n" + |
| 8771 |
" ((s & 0x02) << 5) |\n" + |
| 8772 |
" ((s & 0x01) << 7));\n" + |
| 8773 |
" }\n" + |
| 8774 |
" }\n" + |
| 8775 |
"}\n" |
| 8776 |
); |
| 8777 |
} |
| 8778 |
public void testBug330313_wksp1_27_njl() { |
| 8779 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8780 |
String source = |
| 8781 |
"package wksp1;\n" + |
| 8782 |
"\n" + |
| 8783 |
"public class X27 {\n" + |
| 8784 |
" private void foo() {\n" + |
| 8785 |
"\n" + |
| 8786 |
" if (_VerificationResult.getVerificationCode()\n" + |
| 8787 |
" == IVerificationResult.TYPE_ENTRY_SIGNED_UNRECOGNIZED\n" + |
| 8788 |
" || _VerificationResult.getVerificationCode()\n" + |
| 8789 |
" == IVerificationResult.TYPE_ENTRY_SIGNED_RECOGNIZED) {\n" + |
| 8790 |
" // Group box\n" + |
| 8791 |
" }\n" + |
| 8792 |
" }\n" + |
| 8793 |
"\n" + |
| 8794 |
"}\n"; |
| 8795 |
formatSource(source , |
| 8796 |
"package wksp1;\n" + |
| 8797 |
"\n" + |
| 8798 |
"public class X27 {\n" + |
| 8799 |
" private void foo() {\n" + |
| 8800 |
"\n" + |
| 8801 |
" if (_VerificationResult.getVerificationCode()\n" + |
| 8802 |
" == IVerificationResult.TYPE_ENTRY_SIGNED_UNRECOGNIZED\n" + |
| 8803 |
" || _VerificationResult.getVerificationCode()\n" + |
| 8804 |
" == IVerificationResult.TYPE_ENTRY_SIGNED_RECOGNIZED) {\n" + |
| 8805 |
" // Group box\n" + |
| 8806 |
" }\n" + |
| 8807 |
" }\n" + |
| 8808 |
"\n" + |
| 8809 |
"}\n" |
| 8810 |
); |
| 8811 |
} |
| 8812 |
public void testBug330313_wksp1_28_njl() { |
| 8813 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8814 |
String source = |
| 8815 |
"package wksp1;\n" + |
| 8816 |
"\n" + |
| 8817 |
"public class X28 {\n" + |
| 8818 |
"\n" + |
| 8819 |
" void foo() {\n" + |
| 8820 |
" if (fieldBinding.declaringClass != lastReceiverType\n" + |
| 8821 |
" && !lastReceiverType.isArrayType() \n" + |
| 8822 |
" && fieldBinding.declaringClass != null\n" + |
| 8823 |
" && fieldBinding.constant == NotAConstant\n" + |
| 8824 |
" && ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2\n" + |
| 8825 |
" && (fieldBinding != this.binding || this.indexOfFirstFieldBinding > 1 || !fieldBinding.isStatic())\n" + |
| 8826 |
" && fieldBinding.declaringClass.id != T_Object)\n" + |
| 8827 |
" || !(useDelegate\n" + |
| 8828 |
" ? new CodeSnippetScope(currentScope).canBeSeenByForCodeSnippet(fieldBinding.declaringClass, (ReferenceBinding) this.delegateThis.type)\n" + |
| 8829 |
" : fieldBinding.declaringClass.canBeSeenBy(currentScope)))){\n" + |
| 8830 |
" // code\n" + |
| 8831 |
" }\n" + |
| 8832 |
" }\n" + |
| 8833 |
"}\n"; |
| 8834 |
formatSource(source , |
| 8835 |
"package wksp1;\n" + |
| 8836 |
"\n" + |
| 8837 |
"public class X28 {\n" + |
| 8838 |
"\n" + |
| 8839 |
" void foo() {\n" + |
| 8840 |
" if (fieldBinding.declaringClass != lastReceiverType\n" + |
| 8841 |
" && !lastReceiverType.isArrayType()\n" + |
| 8842 |
" && fieldBinding.declaringClass != null\n" + |
| 8843 |
" && fieldBinding.constant == NotAConstant\n" + |
| 8844 |
" && ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2\n" + |
| 8845 |
" && (fieldBinding != this.binding\n" + |
| 8846 |
" || this.indexOfFirstFieldBinding > 1 || !fieldBinding\n" + |
| 8847 |
" .isStatic())\n" + |
| 8848 |
" && fieldBinding.declaringClass.id != T_Object)\n" + |
| 8849 |
" || !(useDelegate\n" + |
| 8850 |
" ? new CodeSnippetScope(currentScope)\n" + |
| 8851 |
" .canBeSeenByForCodeSnippet(\n" + |
| 8852 |
" fieldBinding.declaringClass,\n" + |
| 8853 |
" (ReferenceBinding) this.delegateThis.type)\n" + |
| 8854 |
" : fieldBinding.declaringClass\n" + |
| 8855 |
" .canBeSeenBy(currentScope)))) {\n" + |
| 8856 |
" // code\n" + |
| 8857 |
" }\n" + |
| 8858 |
" }\n" + |
| 8859 |
"}\n" |
| 8860 |
); |
| 8861 |
} |
| 8862 |
public void testBug330313_wksp1_29_njl() { |
| 8863 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8864 |
String source = |
| 8865 |
"package wksp1;\n" + |
| 8866 |
"\n" + |
| 8867 |
"public class X29 {\n" + |
| 8868 |
"\n" + |
| 8869 |
" boolean foo() {\n" + |
| 8870 |
" return (pack != null && otherpack != null && isSamePackage(pack, otherpack));\n" + |
| 8871 |
" }\n" + |
| 8872 |
"}\n"; |
| 8873 |
formatSource(source , |
| 8874 |
"package wksp1;\n" + |
| 8875 |
"\n" + |
| 8876 |
"public class X29 {\n" + |
| 8877 |
"\n" + |
| 8878 |
" boolean foo() {\n" + |
| 8879 |
" return (pack != null && otherpack != null && isSamePackage(pack,\n" + |
| 8880 |
" otherpack));\n" + |
| 8881 |
" }\n" + |
| 8882 |
"}\n" |
| 8883 |
); |
| 8884 |
} |
| 8885 |
public void testBug330313_wksp1_30_njl() { |
| 8886 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8887 |
String source = |
| 8888 |
"package wksp1;\n" + |
| 8889 |
"\n" + |
| 8890 |
"public class X30 {\n" + |
| 8891 |
" private boolean isInTypeNestedInInputType(ASTNode node, TypeDeclaration inputType){\n" + |
| 8892 |
" return (isInAnonymousTypeInsideInputType(node, inputType) ||\n" + |
| 8893 |
" isInLocalTypeInsideInputType(node, inputType) ||\n" + |
| 8894 |
" isInNonStaticMemberTypeInsideInputType(node, inputType));\n" + |
| 8895 |
" }\n" + |
| 8896 |
"}\n"; |
| 8897 |
formatSource(source , |
| 8898 |
"package wksp1;\n" + |
| 8899 |
"\n" + |
| 8900 |
"public class X30 {\n" + |
| 8901 |
" private boolean isInTypeNestedInInputType(ASTNode node,\n" + |
| 8902 |
" TypeDeclaration inputType) {\n" + |
| 8903 |
" return (isInAnonymousTypeInsideInputType(node, inputType) ||\n" + |
| 8904 |
" isInLocalTypeInsideInputType(node, inputType) || isInNonStaticMemberTypeInsideInputType(\n" + |
| 8905 |
" node, inputType));\n" + |
| 8906 |
" }\n" + |
| 8907 |
"}\n" |
| 8908 |
); |
| 8909 |
} |
| 8910 |
public void testBug330313_wksp1_31_njl() { |
| 8911 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8912 |
String source = |
| 8913 |
"package wksp1;\n" + |
| 8914 |
"\n" + |
| 8915 |
"public class X31 {\n" + |
| 8916 |
" void foo(int i) {\n" + |
| 8917 |
" if (true) {\n" + |
| 8918 |
" switch (i) {\n" + |
| 8919 |
" case 0:\n" + |
| 8920 |
" if (!((offset == (hashable.length - 1)) && !has95 && hasOneOf(meta63, hashable, offset - 2, 2) && !hasOneOf(meta64, hashable, offset - 4, 2)))\n" + |
| 8921 |
" buffer.append(\'R\');\n" + |
| 8922 |
" break;\n" + |
| 8923 |
" }\n" + |
| 8924 |
" }\n" + |
| 8925 |
" }\n" + |
| 8926 |
"}\n"; |
| 8927 |
formatSource(source , |
| 8928 |
"package wksp1;\n" + |
| 8929 |
"\n" + |
| 8930 |
"public class X31 {\n" + |
| 8931 |
" void foo(int i) {\n" + |
| 8932 |
" if (true) {\n" + |
| 8933 |
" switch (i) {\n" + |
| 8934 |
" case 0:\n" + |
| 8935 |
" if (!((offset == (hashable.length - 1)) && !has95\n" + |
| 8936 |
" && hasOneOf(meta63, hashable, offset - 2, 2) && !hasOneOf(\n" + |
| 8937 |
" meta64, hashable, offset - 4, 2)))\n" + |
| 8938 |
" buffer.append(\'R\');\n" + |
| 8939 |
" break;\n" + |
| 8940 |
" }\n" + |
| 8941 |
" }\n" + |
| 8942 |
" }\n" + |
| 8943 |
"}\n" |
| 8944 |
); |
| 8945 |
} |
| 8946 |
public void testBug330313_wksp1_32_njl() { |
| 8947 |
this.formatterPrefs.join_wrapped_lines = false; |
| 8948 |
String source = |
| 8949 |
"package wksp1;\n" + |
| 8950 |
"\n" + |
| 8951 |
"public class X32 {\n" + |
| 8952 |
" public boolean equals(Object object) {\n" + |
| 8953 |
" TextAttribute a= (TextAttribute) object;\n" + |
| 8954 |
" return (a.style == style && equals(a.foreground, foreground) && equals(a.background, background));\n" + |
| 8955 |
" }\n" + |
| 8956 |
"}\n"; |
| 8957 |
formatSource(source , |
| 8958 |
"package wksp1;\n" + |
| 8959 |
"\n" + |
| 8960 |
"public class X32 {\n" + |
| 8961 |
" public boolean equals(Object object) {\n" + |
| 8962 |
" TextAttribute a = (TextAttribute) object;\n" + |
| 8963 |
" return (a.style == style && equals(a.foreground, foreground) && equals(\n" + |
| 8964 |
" a.background, background));\n" + |
| 8965 |
" }\n" + |
| 8966 |
"}\n" |
| 8967 |
); |
| 8968 |
} |
| 8969 |
// Test case extracted from differences noticed with patch v29.txt |
| 8970 |
public void testBug330313_wksp1_33() { |
| 8971 |
String source = |
| 8972 |
"package wksp1;\n" + |
| 8973 |
"\n" + |
| 8974 |
"public class X33 {\n" + |
| 8975 |
" void foo() {\n" + |
| 8976 |
" if(inMetaTag &&\n" + |
| 8977 |
" ( t1.image.equalsIgnoreCase(\"name\") ||\n" + |
| 8978 |
" t1.image.equalsIgnoreCase(\"HTTP-EQUIV\")\n" + |
| 8979 |
" )\n" + |
| 8980 |
" && t2 != null)\n" + |
| 8981 |
" {\n" + |
| 8982 |
" currentMetaTag=t2.image.toLowerCase();\n" + |
| 8983 |
" }\n" + |
| 8984 |
" }\n" + |
| 8985 |
"}\n"; |
| 8986 |
formatSource(source , |
| 8987 |
"package wksp1;\n" + |
| 8988 |
"\n" + |
| 8989 |
"public class X33 {\n" + |
| 8990 |
" void foo() {\n" + |
| 8991 |
" if (inMetaTag\n" + |
| 8992 |
" && (t1.image.equalsIgnoreCase(\"name\") || t1.image\n" + |
| 8993 |
" .equalsIgnoreCase(\"HTTP-EQUIV\")) && t2 != null) {\n" + |
| 8994 |
" currentMetaTag = t2.image.toLowerCase();\n" + |
| 8995 |
" }\n" + |
| 8996 |
" }\n" + |
| 8997 |
"}\n" |
| 8998 |
); |
| 8999 |
} |
| 9000 |
public void testBug330313_wksp1_33_njl() { |
| 9001 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9002 |
String source = |
| 9003 |
"package wksp1;\n" + |
| 9004 |
"\n" + |
| 9005 |
"public class X33 {\n" + |
| 9006 |
" void foo() {\n" + |
| 9007 |
" if(inMetaTag &&\n" + |
| 9008 |
" ( t1.image.equalsIgnoreCase(\"name\") ||\n" + |
| 9009 |
" t1.image.equalsIgnoreCase(\"HTTP-EQUIV\")\n" + |
| 9010 |
" )\n" + |
| 9011 |
" && t2 != null)\n" + |
| 9012 |
" {\n" + |
| 9013 |
" currentMetaTag=t2.image.toLowerCase();\n" + |
| 9014 |
" }\n" + |
| 9015 |
" }\n" + |
| 9016 |
"}\n"; |
| 9017 |
formatSource(source , |
| 9018 |
"package wksp1;\n" + |
| 9019 |
"\n" + |
| 9020 |
"public class X33 {\n" + |
| 9021 |
" void foo() {\n" + |
| 9022 |
" if (inMetaTag &&\n" + |
| 9023 |
" (t1.image.equalsIgnoreCase(\"name\") ||\n" + |
| 9024 |
" t1.image.equalsIgnoreCase(\"HTTP-EQUIV\")\n" + |
| 9025 |
" )\n" + |
| 9026 |
" && t2 != null)\n" + |
| 9027 |
" {\n" + |
| 9028 |
" currentMetaTag = t2.image.toLowerCase();\n" + |
| 9029 |
" }\n" + |
| 9030 |
" }\n" + |
| 9031 |
"}\n" |
| 9032 |
); |
| 9033 |
} |
| 9034 |
public void testBug330313_wksp1_34_njl() { |
| 9035 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9036 |
String source = |
| 9037 |
"package wksp1;\n" + |
| 9038 |
"\n" + |
| 9039 |
"public class X34 {\n" + |
| 9040 |
" private boolean compareMarkers(ResourceInfo oldElement, ResourceInfo newElement) {\n" + |
| 9041 |
" boolean bothNull = oldElement.getMarkers(false) == null && newElement.getMarkers(false) == null;\n" + |
| 9042 |
" return bothNull || oldElement.getMarkerGenerationCount() == newElement.getMarkerGenerationCount();\n" + |
| 9043 |
" }\n" + |
| 9044 |
" private boolean compareSync(ResourceInfo oldElement, ResourceInfo newElement) {\n" + |
| 9045 |
" return oldElement.getSyncInfoGenerationCount() == newElement.getSyncInfoGenerationCount();\n" + |
| 9046 |
" }\n" + |
| 9047 |
"}\n"; |
| 9048 |
formatSource(source , |
| 9049 |
"package wksp1;\n" + |
| 9050 |
"\n" + |
| 9051 |
"public class X34 {\n" + |
| 9052 |
" private boolean compareMarkers(ResourceInfo oldElement,\n" + |
| 9053 |
" ResourceInfo newElement) {\n" + |
| 9054 |
" boolean bothNull = oldElement.getMarkers(false) == null\n" + |
| 9055 |
" && newElement.getMarkers(false) == null;\n" + |
| 9056 |
" return bothNull\n" + |
| 9057 |
" || oldElement.getMarkerGenerationCount() == newElement\n" + |
| 9058 |
" .getMarkerGenerationCount();\n" + |
| 9059 |
" }\n" + |
| 9060 |
"\n" + |
| 9061 |
" private boolean compareSync(ResourceInfo oldElement, ResourceInfo newElement) {\n" + |
| 9062 |
" return oldElement.getSyncInfoGenerationCount() == newElement\n" + |
| 9063 |
" .getSyncInfoGenerationCount();\n" + |
| 9064 |
" }\n" + |
| 9065 |
"}\n" |
| 9066 |
); |
| 9067 |
} |
| 9068 |
// Test case extracted from differences noticed with patch v30.txt |
| 9069 |
public void testBug330313_wksp1_35_njl() { |
| 9070 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9071 |
String source = |
| 9072 |
"package wksp1;\n" + |
| 9073 |
"\n" + |
| 9074 |
"public class X35 {\n" + |
| 9075 |
" void foo() {\n" + |
| 9076 |
" if (true) {\n" + |
| 9077 |
" if (20+lineNum*printGC.getFontMetrics().getHeight() > printer.getClientArea().height) {\n" + |
| 9078 |
" //\n" + |
| 9079 |
" }\n" + |
| 9080 |
" }\n" + |
| 9081 |
" }\n" + |
| 9082 |
"}\n"; |
| 9083 |
formatSource(source , |
| 9084 |
"package wksp1;\n" + |
| 9085 |
"\n" + |
| 9086 |
"public class X35 {\n" + |
| 9087 |
" void foo() {\n" + |
| 9088 |
" if (true) {\n" + |
| 9089 |
" if (20 + lineNum * printGC.getFontMetrics().getHeight() > printer\n" + |
| 9090 |
" .getClientArea().height) {\n" + |
| 9091 |
" //\n" + |
| 9092 |
" }\n" + |
| 9093 |
" }\n" + |
| 9094 |
" }\n" + |
| 9095 |
"}\n" |
| 9096 |
); |
| 9097 |
} |
| 9098 |
// Test case extracted from differences noticed with patch v32.txt |
| 9099 |
public void testBug330313_wksp1_36_njl() { |
| 9100 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9101 |
String source = |
| 9102 |
"package wksp1;\n" + |
| 9103 |
"\n" + |
| 9104 |
"public class X36 {\n" + |
| 9105 |
" public static boolean isRuntimeException(ITypeBinding thrownException) {\n" + |
| 9106 |
" if (thrownException == null || thrownException.isPrimitive() || thrownException.isArray())\n" + |
| 9107 |
" return false;\n" + |
| 9108 |
" return findTypeInHierarchy(thrownException, \"java.lang.RuntimeException\") != null; //$NON-NLS-1$\n" + |
| 9109 |
" }\n" + |
| 9110 |
"}\n"; |
| 9111 |
formatSource(source , |
| 9112 |
"package wksp1;\n" + |
| 9113 |
"\n" + |
| 9114 |
"public class X36 {\n" + |
| 9115 |
" public static boolean isRuntimeException(ITypeBinding thrownException) {\n" + |
| 9116 |
" if (thrownException == null || thrownException.isPrimitive()\n" + |
| 9117 |
" || thrownException.isArray())\n" + |
| 9118 |
" return false;\n" + |
| 9119 |
" return findTypeInHierarchy(thrownException,\n" + |
| 9120 |
" \"java.lang.RuntimeException\") != null; //$NON-NLS-1$\n" + |
| 9121 |
" }\n" + |
| 9122 |
"}\n" |
| 9123 |
); |
| 9124 |
} |
| 9125 |
public void testBug330313_wksp1_37_njl() { |
| 9126 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9127 |
String source = |
| 9128 |
"package wksp1;\n" + |
| 9129 |
"\n" + |
| 9130 |
"public class X37 {\n" + |
| 9131 |
" void foo() {\n" + |
| 9132 |
" if (true) {\n" + |
| 9133 |
" if (ignoreQuickDiffPrefPage && (info.getAnnotationType().equals(\"org.eclipse.ui.workbench.texteditor.quickdiffChange\") //$NON-NLS-1$\n" + |
| 9134 |
" || (info.getAnnotationType().equals(\"org.eclipse.ui.workbench.texteditor.quickdiffAddition\")) //$NON-NLS-1$\n" + |
| 9135 |
" || (info.getAnnotationType().equals(\"org.eclipse.ui.workbench.texteditor.quickdiffDeletion\")) //$NON-NLS-1$\n" + |
| 9136 |
" )) \n" + |
| 9137 |
" continue;\n" + |
| 9138 |
" }\n" + |
| 9139 |
" }\n" + |
| 9140 |
"}\n"; |
| 9141 |
formatSource(source , |
| 9142 |
"package wksp1;\n" + |
| 9143 |
"\n" + |
| 9144 |
"public class X37 {\n" + |
| 9145 |
" void foo() {\n" + |
| 9146 |
" if (true) {\n" + |
| 9147 |
" if (ignoreQuickDiffPrefPage\n" + |
| 9148 |
" && (info.getAnnotationType()\n" + |
| 9149 |
" .equals(\"org.eclipse.ui.workbench.texteditor.quickdiffChange\") //$NON-NLS-1$\n" + |
| 9150 |
" || (info.getAnnotationType()\n" + |
| 9151 |
" .equals(\"org.eclipse.ui.workbench.texteditor.quickdiffAddition\")) //$NON-NLS-1$\n" + |
| 9152 |
" || (info.getAnnotationType()\n" + |
| 9153 |
" .equals(\"org.eclipse.ui.workbench.texteditor.quickdiffDeletion\")) //$NON-NLS-1$\n" + |
| 9154 |
" ))\n" + |
| 9155 |
" continue;\n" + |
| 9156 |
" }\n" + |
| 9157 |
" }\n" + |
| 9158 |
"}\n" |
| 9159 |
); |
| 9160 |
} |
| 9161 |
// Test case extracted from differences noticed with patch v33.txt |
| 9162 |
public void testBug330313_wksp1_38_njl() { |
| 9163 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9164 |
String source = |
| 9165 |
"package wksp1;\n" + |
| 9166 |
"\n" + |
| 9167 |
"public class X38 {\n" + |
| 9168 |
" void foo(boolean condition) {\n" + |
| 9169 |
" if (condition)\n" + |
| 9170 |
" {\n" + |
| 9171 |
" // block 1\n" + |
| 9172 |
" }\n" + |
| 9173 |
" else\n" + |
| 9174 |
" {\n" + |
| 9175 |
" // block 2\n" + |
| 9176 |
" }\n" + |
| 9177 |
" }\n" + |
| 9178 |
"}\n"; |
| 9179 |
formatSource(source ); |
| 9180 |
} |
| 9181 |
public void testBug330313_wksp1_39_njl() { |
| 9182 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9183 |
String source = |
| 9184 |
"package wksp1;\n" + |
| 9185 |
"\n" + |
| 9186 |
"public class X39 {\n" + |
| 9187 |
"/**\n" + |
| 9188 |
" * <pre>\n" + |
| 9189 |
" * RadioGroupFieldEditor editor= new RadioGroupFieldEditor(\n" + |
| 9190 |
" * \"GeneralPage.DoubleClick\", resName, 1,\n" + |
| 9191 |
" * new String[][] {\n" + |
| 9192 |
" * {\"Open Browser\", \"open\"},\n" + |
| 9193 |
" * {\"Expand Tree\", \"expand\"}\n" + |
| 9194 |
" * },\n" + |
| 9195 |
" * parent); \n" + |
| 9196 |
" * </pre>\n" + |
| 9197 |
" */\n" + |
| 9198 |
"public void foo() {\n" + |
| 9199 |
"}\n" + |
| 9200 |
"}\n"; |
| 9201 |
formatSource(source , |
| 9202 |
"package wksp1;\n" + |
| 9203 |
"\n" + |
| 9204 |
"public class X39 {\n" + |
| 9205 |
" /**\n" + |
| 9206 |
" * <pre>\n" + |
| 9207 |
" * RadioGroupFieldEditor editor = new RadioGroupFieldEditor(\n" + |
| 9208 |
" * "GeneralPage.DoubleClick", resName, 1,\n" + |
| 9209 |
" * new String[][] {\n" + |
| 9210 |
" * { "Open Browser", "open" },\n" + |
| 9211 |
" * { "Expand Tree", "expand" }\n" + |
| 9212 |
" * },\n" + |
| 9213 |
" * parent);\n" + |
| 9214 |
" * </pre>\n" + |
| 9215 |
" */\n" + |
| 9216 |
" public void foo() {\n" + |
| 9217 |
" }\n" + |
| 9218 |
"}\n" |
| 9219 |
); |
| 9220 |
} |
| 9221 |
public void testBug330313_wksp1_40_njl() { |
| 9222 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9223 |
String source = |
| 9224 |
"package wksp1;\n" + |
| 9225 |
"\n" + |
| 9226 |
"public class X40 {\n" + |
| 9227 |
" protected final static String[][] TABLE= new String[][] {\n" + |
| 9228 |
" /*INACTIVE*/ /*PARTLY_ACTIVE */ /*ACTIVE */\n" + |
| 9229 |
" /* INACTIVE */ { \"INACTIVE\", \"PARTLY_ACTIVE\", \"PARTLY_ACTIVE\" },\n" + |
| 9230 |
" /* PARTLY_ACTIVE*/ { \"PARTLY_ACTIVE\", \"PARTLY_ACTIVE\", \"PARTLY_ACTIVE\" },\n" + |
| 9231 |
" /* ACTIVE */ { \"PARTLY_ACTIVE\", \"PARTLY_ACTIVE\", \"ACTIVE\"}\n" + |
| 9232 |
" };\n" + |
| 9233 |
"}\n"; |
| 9234 |
formatSource(source , |
| 9235 |
"package wksp1;\n" + |
| 9236 |
"\n" + |
| 9237 |
"public class X40 {\n" + |
| 9238 |
" protected final static String[][] TABLE = new String[][] {\n" + |
| 9239 |
" /* INACTIVE *//* PARTLY_ACTIVE *//* ACTIVE */\n" + |
| 9240 |
" /* INACTIVE */{ \"INACTIVE\", \"PARTLY_ACTIVE\", \"PARTLY_ACTIVE\" },\n" + |
| 9241 |
" /* PARTLY_ACTIVE */{ \"PARTLY_ACTIVE\", \"PARTLY_ACTIVE\",\n" + |
| 9242 |
" \"PARTLY_ACTIVE\" },\n" + |
| 9243 |
" /* ACTIVE */{ \"PARTLY_ACTIVE\", \"PARTLY_ACTIVE\", \"ACTIVE\" }\n" + |
| 9244 |
" };\n" + |
| 9245 |
"}\n" |
| 9246 |
); |
| 9247 |
} |
| 9248 |
public void testBug330313_wksp1_41_njl() { |
| 9249 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9250 |
String source = |
| 9251 |
"package wksp1;\n" + |
| 9252 |
"\n" + |
| 9253 |
"public class X41 {\n" + |
| 9254 |
" static final int [][] TABLE = {\n" + |
| 9255 |
" \n" + |
| 9256 |
" /* First */\n" + |
| 9257 |
" {1, 2},\n" + |
| 9258 |
" {3, 4},\n" + |
| 9259 |
" {5, 6},\n" + |
| 9260 |
"// {7????, 8},\n" + |
| 9261 |
"\n" + |
| 9262 |
" /* Second */ \n" + |
| 9263 |
"// {11, 12},\n" + |
| 9264 |
"// {13, 14},\n" + |
| 9265 |
"// {15, 16},\n" + |
| 9266 |
" \n" + |
| 9267 |
" \n" + |
| 9268 |
" /* Third */\n" + |
| 9269 |
" {21, 22},\n" + |
| 9270 |
" {23, 24},\n" + |
| 9271 |
" {25, 26},\n" + |
| 9272 |
"// {27????, 28},\n" + |
| 9273 |
"\n" + |
| 9274 |
" /* Others */\n" + |
| 9275 |
" {31, 32},\n" + |
| 9276 |
" {33, 34},\n" + |
| 9277 |
" {35, 36},\n" + |
| 9278 |
"// {37????, 38},\n" + |
| 9279 |
" \n" + |
| 9280 |
" };\n" + |
| 9281 |
"}\n"; |
| 9282 |
formatSource(source , |
| 9283 |
"package wksp1;\n" + |
| 9284 |
"\n" + |
| 9285 |
"public class X41 {\n" + |
| 9286 |
" static final int[][] TABLE = {\n" + |
| 9287 |
"\n" + |
| 9288 |
" /* First */\n" + |
| 9289 |
" { 1, 2 },\n" + |
| 9290 |
" { 3, 4 },\n" + |
| 9291 |
" { 5, 6 },\n" + |
| 9292 |
" // {7????, 8},\n" + |
| 9293 |
"\n" + |
| 9294 |
" /* Second */\n" + |
| 9295 |
" // {11, 12},\n" + |
| 9296 |
" // {13, 14},\n" + |
| 9297 |
" // {15, 16},\n" + |
| 9298 |
"\n" + |
| 9299 |
" /* Third */\n" + |
| 9300 |
" { 21, 22 },\n" + |
| 9301 |
" { 23, 24 },\n" + |
| 9302 |
" { 25, 26 },\n" + |
| 9303 |
" // {27????, 28},\n" + |
| 9304 |
"\n" + |
| 9305 |
" /* Others */\n" + |
| 9306 |
" { 31, 32 },\n" + |
| 9307 |
" { 33, 34 },\n" + |
| 9308 |
" { 35, 36 },\n" + |
| 9309 |
" // {37????, 38},\n" + |
| 9310 |
"\n" + |
| 9311 |
" };\n" + |
| 9312 |
"}\n" |
| 9313 |
); |
| 9314 |
} |
| 9315 |
public void testBug330313_wksp1_42_njl() { |
| 9316 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9317 |
String source = |
| 9318 |
"package wksp1;\n" + |
| 9319 |
"\n" + |
| 9320 |
"public class X42 {\n" + |
| 9321 |
" static final byte[][] DashList = {\n" + |
| 9322 |
" { }, // SWT.LINE_SOLID\n" + |
| 9323 |
" { 10, 4 }, // SWT.LINE_DASH\n" + |
| 9324 |
" { 2, 2 }, // SWT.LINE_DOT\n" + |
| 9325 |
" { 10, 4, 2, 4 }, // SWT.LINE_DASHDOT\n" + |
| 9326 |
" { 10, 4, 2, 4, 2, 4 } // SWT.LINE_DASHDOTDOT\n" + |
| 9327 |
" };\n" + |
| 9328 |
"}\n"; |
| 9329 |
formatSource(source , |
| 9330 |
"package wksp1;\n" + |
| 9331 |
"\n" + |
| 9332 |
"public class X42 {\n" + |
| 9333 |
" static final byte[][] DashList = {\n" + |
| 9334 |
" {}, // SWT.LINE_SOLID\n" + |
| 9335 |
" { 10, 4 }, // SWT.LINE_DASH\n" + |
| 9336 |
" { 2, 2 }, // SWT.LINE_DOT\n" + |
| 9337 |
" { 10, 4, 2, 4 }, // SWT.LINE_DASHDOT\n" + |
| 9338 |
" { 10, 4, 2, 4, 2, 4 } // SWT.LINE_DASHDOTDOT\n" + |
| 9339 |
" };\n" + |
| 9340 |
"}\n" |
| 9341 |
); |
| 9342 |
} |
| 9343 |
public void testBug330313_wksp1_43_njl() { |
| 9344 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9345 |
String source = |
| 9346 |
"package wksp1;\n" + |
| 9347 |
"\n" + |
| 9348 |
"public class X43 {\n" + |
| 9349 |
" Cloneable clone;\n" + |
| 9350 |
"X43() {\n" + |
| 9351 |
" this.clone = new Cloneable() {\n" + |
| 9352 |
" void foo(int x) {\n" + |
| 9353 |
" switch (x) {\n" + |
| 9354 |
" case 1:\n" + |
| 9355 |
" case 2:\n" + |
| 9356 |
" if (true) break;\n" + |
| 9357 |
" // FALL THROUGH\n" + |
| 9358 |
" case 3:\n" + |
| 9359 |
" case 4:\n" + |
| 9360 |
" break;\n" + |
| 9361 |
" }\n" + |
| 9362 |
" }\n" + |
| 9363 |
" };\n" + |
| 9364 |
"}\n" + |
| 9365 |
"}\n"; |
| 9366 |
formatSource(source , |
| 9367 |
"package wksp1;\n" + |
| 9368 |
"\n" + |
| 9369 |
"public class X43 {\n" + |
| 9370 |
" Cloneable clone;\n" + |
| 9371 |
"\n" + |
| 9372 |
" X43() {\n" + |
| 9373 |
" this.clone = new Cloneable() {\n" + |
| 9374 |
" void foo(int x) {\n" + |
| 9375 |
" switch (x) {\n" + |
| 9376 |
" case 1:\n" + |
| 9377 |
" case 2:\n" + |
| 9378 |
" if (true)\n" + |
| 9379 |
" break;\n" + |
| 9380 |
" // FALL THROUGH\n" + |
| 9381 |
" case 3:\n" + |
| 9382 |
" case 4:\n" + |
| 9383 |
" break;\n" + |
| 9384 |
" }\n" + |
| 9385 |
" }\n" + |
| 9386 |
" };\n" + |
| 9387 |
" }\n" + |
| 9388 |
"}\n" |
| 9389 |
); |
| 9390 |
} |
| 9391 |
public void testBug330313_wksp1_44_njl() { |
| 9392 |
// TODO Could be improved to put the all array statements at the same indentation... |
| 9393 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9394 |
String source = |
| 9395 |
"package wksp1;\n" + |
| 9396 |
"\n" + |
| 9397 |
"public class X44 {\n" + |
| 9398 |
" String foo() {\n" + |
| 9399 |
" return Policy.bind(\"CVSAnnotateBlock.6\", new Object[] { //$NON-NLS-1$\n" + |
| 9400 |
" user,\n" + |
| 9401 |
" revision,\n" + |
| 9402 |
" String.valueOf(delta),\n" + |
| 9403 |
" line\n" + |
| 9404 |
" });\n" + |
| 9405 |
" }\n" + |
| 9406 |
"}\n"; |
| 9407 |
formatSource(source , |
| 9408 |
"package wksp1;\n" + |
| 9409 |
"\n" + |
| 9410 |
"public class X44 {\n" + |
| 9411 |
" String foo() {\n" + |
| 9412 |
" return Policy.bind(\"CVSAnnotateBlock.6\", new Object[] { //$NON-NLS-1$\n" + |
| 9413 |
" user,\n" + |
| 9414 |
" revision,\n" + |
| 9415 |
" String.valueOf(delta),\n" + |
| 9416 |
" line\n" + |
| 9417 |
" });\n" + |
| 9418 |
" }\n" + |
| 9419 |
"}\n" |
| 9420 |
); |
| 9421 |
} |
| 9422 |
public void testBug330313_wksp1_45_njl() { |
| 9423 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9424 |
String source = |
| 9425 |
"package wksp1;\n" + |
| 9426 |
"\n" + |
| 9427 |
"public class X45 {\n" + |
| 9428 |
" private String[][] TABLE = {\n" + |
| 9429 |
" {\"COL_REVISION\", \"COL_DATE\", \"COL_AUTHOR\", \"COL_COMMENT\", \"COL_TAGS\"}, /* revision */ \n" + |
| 9430 |
" {\"COL_TAGS\", \"COL_REVISION\", \"COL_DATE\", \"COL_AUTHOR\", \"COL_COMMENT\"}, /* tags */\n" + |
| 9431 |
" {\"COL_DATE\", \"COL_REVISION\", \"COL_AUTHOR\", \"COL_COMMENT\", \"COL_TAGS\"}, /* date */\n" + |
| 9432 |
" {\"COL_AUTHOR\", \"COL_REVISION\", \"COL_DATE\", \"COL_COMMENT\", \"COL_TAGS\"}, /* author */\n" + |
| 9433 |
" {\"COL_COMMENT\", \"COL_REVISION\", \"COL_DATE\", \"COL_AUTHOR\", \"COL_TAGS\"} /* comment */\n" + |
| 9434 |
" };\n" + |
| 9435 |
"}\n"; |
| 9436 |
formatSource(source , |
| 9437 |
"package wksp1;\n" + |
| 9438 |
"\n" + |
| 9439 |
"public class X45 {\n" + |
| 9440 |
" private String[][] TABLE = {\n" + |
| 9441 |
" { \"COL_REVISION\", \"COL_DATE\", \"COL_AUTHOR\", \"COL_COMMENT\",\n" + |
| 9442 |
" \"COL_TAGS\" }, /* revision */\n" + |
| 9443 |
" { \"COL_TAGS\", \"COL_REVISION\", \"COL_DATE\", \"COL_AUTHOR\",\n" + |
| 9444 |
" \"COL_COMMENT\" }, /* tags */\n" + |
| 9445 |
" { \"COL_DATE\", \"COL_REVISION\", \"COL_AUTHOR\", \"COL_COMMENT\",\n" + |
| 9446 |
" \"COL_TAGS\" }, /* date */\n" + |
| 9447 |
" { \"COL_AUTHOR\", \"COL_REVISION\", \"COL_DATE\", \"COL_COMMENT\",\n" + |
| 9448 |
" \"COL_TAGS\" }, /* author */\n" + |
| 9449 |
" { \"COL_COMMENT\", \"COL_REVISION\", \"COL_DATE\", \"COL_AUTHOR\",\n" + |
| 9450 |
" \"COL_TAGS\" } /* comment */\n" + |
| 9451 |
" };\n" + |
| 9452 |
"}\n" |
| 9453 |
); |
| 9454 |
} |
| 9455 |
public void testBug330313_wksp1_46_njl() { |
| 9456 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9457 |
String source = |
| 9458 |
"package wksp1;\n" + |
| 9459 |
"\n" + |
| 9460 |
"public class X46 {\n" + |
| 9461 |
" void foo() {\n" + |
| 9462 |
" if (getActive() == StackPresentation.AS_ACTIVE_NOFOCUS) {\n" + |
| 9463 |
" drawGradient(\n" + |
| 9464 |
" colorRegistry.get(IWorkbenchThemeConstants.INACTIVE_TAB_TEXT_COLOR), \n" + |
| 9465 |
" new Color [] {\n" + |
| 9466 |
" colorRegistry.get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_START) \n" + |
| 9467 |
" }, \n" + |
| 9468 |
" new int [0],\n" + |
| 9469 |
" true); \n" + |
| 9470 |
" }\n" + |
| 9471 |
" }\n" + |
| 9472 |
"}\n"; |
| 9473 |
formatSource(source , |
| 9474 |
"package wksp1;\n" + |
| 9475 |
"\n" + |
| 9476 |
"public class X46 {\n" + |
| 9477 |
" void foo() {\n" + |
| 9478 |
" if (getActive() == StackPresentation.AS_ACTIVE_NOFOCUS) {\n" + |
| 9479 |
" drawGradient(\n" + |
| 9480 |
" colorRegistry\n" + |
| 9481 |
" .get(IWorkbenchThemeConstants.INACTIVE_TAB_TEXT_COLOR),\n" + |
| 9482 |
" new Color[] {\n" + |
| 9483 |
" colorRegistry\n" + |
| 9484 |
" .get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_START)\n" + |
| 9485 |
" },\n" + |
| 9486 |
" new int[0],\n" + |
| 9487 |
" true);\n" + |
| 9488 |
" }\n" + |
| 9489 |
" }\n" + |
| 9490 |
"}\n" |
| 9491 |
); |
| 9492 |
} |
| 9493 |
public void testBug330313_wksp1_47_njl() { |
| 9494 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9495 |
String source = |
| 9496 |
"package wksp1;\n" + |
| 9497 |
"\n" + |
| 9498 |
"public class X47 {\n" + |
| 9499 |
" void foo(int x) {\n" + |
| 9500 |
" switch (x) {\n" + |
| 9501 |
" case 0 :\n" + |
| 9502 |
" // case 0\n" + |
| 9503 |
" break;\n" + |
| 9504 |
" case 3 :\n" + |
| 9505 |
" // case 3\n" + |
| 9506 |
" break;\n" + |
| 9507 |
" //case -1 :\n" + |
| 9508 |
" // internal failure: trying to load variable not supposed to be generated\n" + |
| 9509 |
" // break;\n" + |
| 9510 |
" default :\n" + |
| 9511 |
" // default\n" + |
| 9512 |
" }\n" + |
| 9513 |
" // last comment\n" + |
| 9514 |
" }\n" + |
| 9515 |
"}\n"; |
| 9516 |
formatSource(source , |
| 9517 |
"package wksp1;\n" + |
| 9518 |
"\n" + |
| 9519 |
"public class X47 {\n" + |
| 9520 |
" void foo(int x) {\n" + |
| 9521 |
" switch (x) {\n" + |
| 9522 |
" case 0:\n" + |
| 9523 |
" // case 0\n" + |
| 9524 |
" break;\n" + |
| 9525 |
" case 3:\n" + |
| 9526 |
" // case 3\n" + |
| 9527 |
" break;\n" + |
| 9528 |
" // case -1 :\n" + |
| 9529 |
" // internal failure: trying to load variable not supposed to be\n" + |
| 9530 |
" // generated\n" + |
| 9531 |
" // break;\n" + |
| 9532 |
" default:\n" + |
| 9533 |
" // default\n" + |
| 9534 |
" }\n" + |
| 9535 |
" // last comment\n" + |
| 9536 |
" }\n" + |
| 9537 |
"}\n" |
| 9538 |
); |
| 9539 |
} |
| 9540 |
public void testBug330313_wksp1_48_njl() { |
| 9541 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9542 |
String source = |
| 9543 |
"package wksp1;\n" + |
| 9544 |
"\n" + |
| 9545 |
"public class X48 {\n" + |
| 9546 |
" void foo(int x) {\n" + |
| 9547 |
" switch (x) {\n" + |
| 9548 |
" case 0 :\n" + |
| 9549 |
" // case 0\n" + |
| 9550 |
" break;\n" + |
| 9551 |
" case 3 :\n" + |
| 9552 |
" // case 3\n" + |
| 9553 |
" break;\n" + |
| 9554 |
" //case -1 :\n" + |
| 9555 |
" // internal failure: trying to load variable not supposed to be generated\n" + |
| 9556 |
" // break;\n" + |
| 9557 |
" }\n" + |
| 9558 |
" // last comment\n" + |
| 9559 |
" }\n" + |
| 9560 |
"}\n"; |
| 9561 |
formatSource(source , |
| 9562 |
"package wksp1;\n" + |
| 9563 |
"\n" + |
| 9564 |
"public class X48 {\n" + |
| 9565 |
" void foo(int x) {\n" + |
| 9566 |
" switch (x) {\n" + |
| 9567 |
" case 0:\n" + |
| 9568 |
" // case 0\n" + |
| 9569 |
" break;\n" + |
| 9570 |
" case 3:\n" + |
| 9571 |
" // case 3\n" + |
| 9572 |
" break;\n" + |
| 9573 |
" // case -1 :\n" + |
| 9574 |
" // internal failure: trying to load variable not supposed to be\n" + |
| 9575 |
" // generated\n" + |
| 9576 |
" // break;\n" + |
| 9577 |
" }\n" + |
| 9578 |
" // last comment\n" + |
| 9579 |
" }\n" + |
| 9580 |
"}\n" |
| 9581 |
); |
| 9582 |
} |
| 9583 |
public void testBug330313_wksp1_49_njl() { |
| 9584 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9585 |
String source = |
| 9586 |
"package wksp1;\n" + |
| 9587 |
"\n" + |
| 9588 |
"public class X49 {\n" + |
| 9589 |
" void foo(int i) {\n" + |
| 9590 |
" if (true) {\n" + |
| 9591 |
" if (true) {\n" + |
| 9592 |
" this.foundTaskPositions[this.foundTaskCount] = new int[] { i, i + tagLength - 1 };\n" + |
| 9593 |
" }\n" + |
| 9594 |
" }\n" + |
| 9595 |
" }\n" + |
| 9596 |
"}\n"; |
| 9597 |
formatSource(source , |
| 9598 |
"package wksp1;\n" + |
| 9599 |
"\n" + |
| 9600 |
"public class X49 {\n" + |
| 9601 |
" void foo(int i) {\n" + |
| 9602 |
" if (true) {\n" + |
| 9603 |
" if (true) {\n" + |
| 9604 |
" this.foundTaskPositions[this.foundTaskCount] = new int[] { i,\n" + |
| 9605 |
" i + tagLength - 1 };\n" + |
| 9606 |
" }\n" + |
| 9607 |
" }\n" + |
| 9608 |
" }\n" + |
| 9609 |
"}\n" |
| 9610 |
); |
| 9611 |
} |
| 9612 |
public void testBug330313_wksp1_50_njl() { |
| 9613 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9614 |
String source = |
| 9615 |
"package wksp1;\n" + |
| 9616 |
"\n" + |
| 9617 |
"public class X50 {\n" + |
| 9618 |
"private void deployCodeSnippetClassIfNeeded(IRequestor requestor) {\n" + |
| 9619 |
" if (this.codeSnippetBinary == null) {\n" + |
| 9620 |
" // Deploy CodeSnippet class (only once)\n" + |
| 9621 |
" requestor.acceptClassFiles(\n" + |
| 9622 |
" new ClassFile[] {\n" + |
| 9623 |
" new ClassFile() {\n" + |
| 9624 |
" public byte[] getBytes() {\n" + |
| 9625 |
" return getCodeSnippetBytes();\n" + |
| 9626 |
" }\n" + |
| 9627 |
" public char[][] getCompoundName() {\n" + |
| 9628 |
" return EvaluationConstants.ROOT_COMPOUND_NAME;\n" + |
| 9629 |
" }\n" + |
| 9630 |
" }\n" + |
| 9631 |
" }, \n" + |
| 9632 |
" null);\n" + |
| 9633 |
" }\n" + |
| 9634 |
"}\n" + |
| 9635 |
"}\n"; |
| 9636 |
formatSource(source , |
| 9637 |
"package wksp1;\n" + |
| 9638 |
"\n" + |
| 9639 |
"public class X50 {\n" + |
| 9640 |
" private void deployCodeSnippetClassIfNeeded(IRequestor requestor) {\n" + |
| 9641 |
" if (this.codeSnippetBinary == null) {\n" + |
| 9642 |
" // Deploy CodeSnippet class (only once)\n" + |
| 9643 |
" requestor.acceptClassFiles(\n" + |
| 9644 |
" new ClassFile[] {\n" + |
| 9645 |
" new ClassFile() {\n" + |
| 9646 |
" public byte[] getBytes() {\n" + |
| 9647 |
" return getCodeSnippetBytes();\n" + |
| 9648 |
" }\n" + |
| 9649 |
"\n" + |
| 9650 |
" public char[][] getCompoundName() {\n" + |
| 9651 |
" return EvaluationConstants.ROOT_COMPOUND_NAME;\n" + |
| 9652 |
" }\n" + |
| 9653 |
" }\n" + |
| 9654 |
" },\n" + |
| 9655 |
" null);\n" + |
| 9656 |
" }\n" + |
| 9657 |
" }\n" + |
| 9658 |
"}\n" |
| 9659 |
); |
| 9660 |
} |
| 9661 |
public void testBug330313_wksp1_51_njl() { |
| 9662 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9663 |
String source = |
| 9664 |
"package wksp1;\n" + |
| 9665 |
"\n" + |
| 9666 |
"public class X51 {\n" + |
| 9667 |
"\n" + |
| 9668 |
"protected void addAllSourceFiles(final ArrayList sourceFiles) throws CoreException {\n" + |
| 9669 |
" for (int i = 0, l = sourceLocations.length; i < l; i++) {\n" + |
| 9670 |
" sourceLocation.sourceFolder.accept(\n" + |
| 9671 |
" new IResourceProxyVisitor() {\n" + |
| 9672 |
" public boolean visit(IResourceProxy proxy) throws CoreException {\n" + |
| 9673 |
" IResource resource = null;\n" + |
| 9674 |
" switch(proxy.getType()) {\n" + |
| 9675 |
" case IResource.FILE :\n" + |
| 9676 |
" if (exclusionPatterns != null || inclusionPatterns != null) {\n" + |
| 9677 |
" resource = proxy.requestResource();\n" + |
| 9678 |
" if (Util.isExcluded(resource, inclusionPatterns, exclusionPatterns)) return false;\n" + |
| 9679 |
" }\n" + |
| 9680 |
" if (org.eclipse.jdt.internal.compiler.util.Util.isJavaFileName(proxy.getName())) {\n" + |
| 9681 |
" if (resource == null)\n" + |
| 9682 |
" resource = proxy.requestResource();\n" + |
| 9683 |
" sourceFiles.add(new SourceFile((IFile) resource, sourceLocation));\n" + |
| 9684 |
" }\n" + |
| 9685 |
" return false;\n" + |
| 9686 |
" case IResource.FOLDER :\n" + |
| 9687 |
" if (exclusionPatterns != null && inclusionPatterns == null) {\n" + |
| 9688 |
" // if there are inclusion patterns then we must walk the children\n" + |
| 9689 |
" resource = proxy.requestResource();\n" + |
| 9690 |
" if (Util.isExcluded(resource, inclusionPatterns, exclusionPatterns)) return false;\n" + |
| 9691 |
" }\n" + |
| 9692 |
" if (isAlsoProject && isExcludedFromProject(proxy.requestFullPath())) return false;\n" + |
| 9693 |
" }\n" + |
| 9694 |
" return true;\n" + |
| 9695 |
" }\n" + |
| 9696 |
" },\n" + |
| 9697 |
" IResource.NONE\n" + |
| 9698 |
" );\n" + |
| 9699 |
" notifier.checkCancel();\n" + |
| 9700 |
" }\n" + |
| 9701 |
"}\n" + |
| 9702 |
"}\n"; |
| 9703 |
formatSource(source , |
| 9704 |
"package wksp1;\n" + |
| 9705 |
"\n" + |
| 9706 |
"public class X51 {\n" + |
| 9707 |
"\n" + |
| 9708 |
" protected void addAllSourceFiles(final ArrayList sourceFiles)\n" + |
| 9709 |
" throws CoreException {\n" + |
| 9710 |
" for (int i = 0, l = sourceLocations.length; i < l; i++) {\n" + |
| 9711 |
" sourceLocation.sourceFolder.accept(\n" + |
| 9712 |
" new IResourceProxyVisitor() {\n" + |
| 9713 |
" public boolean visit(IResourceProxy proxy)\n" + |
| 9714 |
" throws CoreException {\n" + |
| 9715 |
" IResource resource = null;\n" + |
| 9716 |
" switch (proxy.getType()) {\n" + |
| 9717 |
" case IResource.FILE:\n" + |
| 9718 |
" if (exclusionPatterns != null\n" + |
| 9719 |
" || inclusionPatterns != null) {\n" + |
| 9720 |
" resource = proxy.requestResource();\n" + |
| 9721 |
" if (Util.isExcluded(resource,\n" + |
| 9722 |
" inclusionPatterns,\n" + |
| 9723 |
" exclusionPatterns))\n" + |
| 9724 |
" return false;\n" + |
| 9725 |
" }\n" + |
| 9726 |
" if (org.eclipse.jdt.internal.compiler.util.Util\n" + |
| 9727 |
" .isJavaFileName(proxy.getName())) {\n" + |
| 9728 |
" if (resource == null)\n" + |
| 9729 |
" resource = proxy.requestResource();\n" + |
| 9730 |
" sourceFiles.add(new SourceFile(\n" + |
| 9731 |
" (IFile) resource, sourceLocation));\n" + |
| 9732 |
" }\n" + |
| 9733 |
" return false;\n" + |
| 9734 |
" case IResource.FOLDER:\n" + |
| 9735 |
" if (exclusionPatterns != null\n" + |
| 9736 |
" && inclusionPatterns == null) {\n" + |
| 9737 |
" // if there are inclusion patterns then we\n" + |
| 9738 |
" // must walk the children\n" + |
| 9739 |
" resource = proxy.requestResource();\n" + |
| 9740 |
" if (Util.isExcluded(resource,\n" + |
| 9741 |
" inclusionPatterns,\n" + |
| 9742 |
" exclusionPatterns))\n" + |
| 9743 |
" return false;\n" + |
| 9744 |
" }\n" + |
| 9745 |
" if (isAlsoProject\n" + |
| 9746 |
" && isExcludedFromProject(proxy\n" + |
| 9747 |
" .requestFullPath()))\n" + |
| 9748 |
" return false;\n" + |
| 9749 |
" }\n" + |
| 9750 |
" return true;\n" + |
| 9751 |
" }\n" + |
| 9752 |
" },\n" + |
| 9753 |
" IResource.NONE\n" + |
| 9754 |
" );\n" + |
| 9755 |
" notifier.checkCancel();\n" + |
| 9756 |
" }\n" + |
| 9757 |
" }\n" + |
| 9758 |
"}\n" |
| 9759 |
); |
| 9760 |
} |
| 9761 |
public void testBug330313_wksp1_52_njl() { |
| 9762 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9763 |
String source = |
| 9764 |
"package wksp1;\n" + |
| 9765 |
"\n" + |
| 9766 |
"public class X52 {\n" + |
| 9767 |
" protected FastSyncInfoFilter getKnownFailureCases() {\n" + |
| 9768 |
" return new OrSyncInfoFilter(new FastSyncInfoFilter[] {\n" + |
| 9769 |
" // Conflicting additions of files will fail\n" + |
| 9770 |
" new AndSyncInfoFilter(new FastSyncInfoFilter[] {\n" + |
| 9771 |
" FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.ADDITION),\n" + |
| 9772 |
" new FastSyncInfoFilter() {\n" + |
| 9773 |
" public boolean select(SyncInfo info) {\n" + |
| 9774 |
" return info.getLocal().getType() == IResource.FILE;\n" + |
| 9775 |
" }\n" + |
| 9776 |
" }\n" + |
| 9777 |
" }),\n" + |
| 9778 |
" // Conflicting changes of files will fail if the local is not managed\n" + |
| 9779 |
" // or is an addition\n" + |
| 9780 |
" new AndSyncInfoFilter(new FastSyncInfoFilter[] {\n" + |
| 9781 |
" FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),\n" + |
| 9782 |
" new FastSyncInfoFilter() {\n" + |
| 9783 |
" public boolean select(SyncInfo info) {\n" + |
| 9784 |
" if (info.getLocal().getType() == IResource.FILE) {\n" + |
| 9785 |
" try {\n" + |
| 9786 |
" ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)info.getLocal());\n" + |
| 9787 |
" byte[] syncBytes = cvsFile.getSyncBytes();\n" + |
| 9788 |
" return (syncBytes == null || ResourceSyncInfo.isAddition(syncBytes));\n" + |
| 9789 |
" } catch (CVSException e) {\n" + |
| 9790 |
" CVSUIPlugin.log(e);\n" + |
| 9791 |
" // Fall though and try to update\n" + |
| 9792 |
" }\n" + |
| 9793 |
" }\n" + |
| 9794 |
" return false;\n" + |
| 9795 |
" }\n" + |
| 9796 |
" }\n" + |
| 9797 |
" }),\n" + |
| 9798 |
" // Conflicting changes involving a deletion on one side will aways fail\n" + |
| 9799 |
" new AndSyncInfoFilter(new FastSyncInfoFilter[] {\n" + |
| 9800 |
" FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),\n" + |
| 9801 |
" new FastSyncInfoFilter() {\n" + |
| 9802 |
" public boolean select(SyncInfo info) {\n" + |
| 9803 |
" IResourceVariant remote = info.getRemote();\n" + |
| 9804 |
" IResourceVariant base = info.getBase();\n" + |
| 9805 |
" if (info.getLocal().exists()) {\n" + |
| 9806 |
" // local != base and no remote will fail\n" + |
| 9807 |
" return (base != null && remote == null);\n" + |
| 9808 |
" } else {\n" + |
| 9809 |
" // no local and base != remote\n" + |
| 9810 |
" return (base != null && remote != null && !base.equals(remote));\n" + |
| 9811 |
" }\n" + |
| 9812 |
" }\n" + |
| 9813 |
" }\n" + |
| 9814 |
" }),\n" + |
| 9815 |
" // Conflicts where the file type is binary will work but are not merged\n" + |
| 9816 |
" // so they should be skipped\n" + |
| 9817 |
" new AndSyncInfoFilter(new FastSyncInfoFilter[] {\n" + |
| 9818 |
" FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),\n" + |
| 9819 |
" new FastSyncInfoFilter() {\n" + |
| 9820 |
" public boolean select(SyncInfo info) {\n" + |
| 9821 |
" IResource local = info.getLocal();\n" + |
| 9822 |
" if (local.getType() == IResource.FILE) {\n" + |
| 9823 |
" try {\n" + |
| 9824 |
" ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile)local);\n" + |
| 9825 |
" byte[] syncBytes = file.getSyncBytes();\n" + |
| 9826 |
" if (syncBytes != null) {\n" + |
| 9827 |
" return ResourceSyncInfo.isBinary(syncBytes);\n" + |
| 9828 |
" }\n" + |
| 9829 |
" } catch (CVSException e) {\n" + |
| 9830 |
" // There was an error obtaining or interpreting the sync bytes\n" + |
| 9831 |
" // Log it and skip the file\n" + |
| 9832 |
" CVSProviderPlugin.log(e);\n" + |
| 9833 |
" return true;\n" + |
| 9834 |
" }\n" + |
| 9835 |
" }\n" + |
| 9836 |
" return false;\n" + |
| 9837 |
" }\n" + |
| 9838 |
" }\n" + |
| 9839 |
" }),\n" + |
| 9840 |
" // Outgoing changes may not fail but they are skipped as well\n" + |
| 9841 |
" new SyncInfoDirectionFilter(SyncInfo.OUTGOING)\n" + |
| 9842 |
" });\n" + |
| 9843 |
" }\n" + |
| 9844 |
"}\n"; |
| 9845 |
formatSource(source , |
| 9846 |
"package wksp1;\n" + |
| 9847 |
"\n" + |
| 9848 |
"public class X52 {\n" + |
| 9849 |
" protected FastSyncInfoFilter getKnownFailureCases() {\n" + |
| 9850 |
" return new OrSyncInfoFilter(new FastSyncInfoFilter[] {\n" + |
| 9851 |
" // Conflicting additions of files will fail\n" + |
| 9852 |
" new AndSyncInfoFilter(new FastSyncInfoFilter[] {\n" + |
| 9853 |
" FastSyncInfoFilter.getDirectionAndChangeFilter(\n" + |
| 9854 |
" SyncInfo.CONFLICTING, SyncInfo.ADDITION),\n" + |
| 9855 |
" new FastSyncInfoFilter() {\n" + |
| 9856 |
" public boolean select(SyncInfo info) {\n" + |
| 9857 |
" return info.getLocal().getType() == IResource.FILE;\n" + |
| 9858 |
" }\n" + |
| 9859 |
" }\n" + |
| 9860 |
" }),\n" + |
| 9861 |
" // Conflicting changes of files will fail if the local is not\n" + |
| 9862 |
" // managed\n" + |
| 9863 |
" // or is an addition\n" + |
| 9864 |
" new AndSyncInfoFilter(new FastSyncInfoFilter[] {\n" + |
| 9865 |
" FastSyncInfoFilter.getDirectionAndChangeFilter(\n" + |
| 9866 |
" SyncInfo.CONFLICTING, SyncInfo.CHANGE),\n" + |
| 9867 |
" new FastSyncInfoFilter() {\n" + |
| 9868 |
" public boolean select(SyncInfo info) {\n" + |
| 9869 |
" if (info.getLocal().getType() == IResource.FILE) {\n" + |
| 9870 |
" try {\n" + |
| 9871 |
" ICVSFile cvsFile = CVSWorkspaceRoot\n" + |
| 9872 |
" .getCVSFileFor((IFile) info\n" + |
| 9873 |
" .getLocal());\n" + |
| 9874 |
" byte[] syncBytes = cvsFile\n" + |
| 9875 |
" .getSyncBytes();\n" + |
| 9876 |
" return (syncBytes == null || ResourceSyncInfo\n" + |
| 9877 |
" .isAddition(syncBytes));\n" + |
| 9878 |
" } catch (CVSException e) {\n" + |
| 9879 |
" CVSUIPlugin.log(e);\n" + |
| 9880 |
" // Fall though and try to update\n" + |
| 9881 |
" }\n" + |
| 9882 |
" }\n" + |
| 9883 |
" return false;\n" + |
| 9884 |
" }\n" + |
| 9885 |
" }\n" + |
| 9886 |
" }),\n" + |
| 9887 |
" // Conflicting changes involving a deletion on one side will\n" + |
| 9888 |
" // aways fail\n" + |
| 9889 |
" new AndSyncInfoFilter(new FastSyncInfoFilter[] {\n" + |
| 9890 |
" FastSyncInfoFilter.getDirectionAndChangeFilter(\n" + |
| 9891 |
" SyncInfo.CONFLICTING, SyncInfo.CHANGE),\n" + |
| 9892 |
" new FastSyncInfoFilter() {\n" + |
| 9893 |
" public boolean select(SyncInfo info) {\n" + |
| 9894 |
" IResourceVariant remote = info.getRemote();\n" + |
| 9895 |
" IResourceVariant base = info.getBase();\n" + |
| 9896 |
" if (info.getLocal().exists()) {\n" + |
| 9897 |
" // local != base and no remote will fail\n" + |
| 9898 |
" return (base != null && remote == null);\n" + |
| 9899 |
" } else {\n" + |
| 9900 |
" // no local and base != remote\n" + |
| 9901 |
" return (base != null && remote != null && !base\n" + |
| 9902 |
" .equals(remote));\n" + |
| 9903 |
" }\n" + |
| 9904 |
" }\n" + |
| 9905 |
" }\n" + |
| 9906 |
" }),\n" + |
| 9907 |
" // Conflicts where the file type is binary will work but are not\n" + |
| 9908 |
" // merged\n" + |
| 9909 |
" // so they should be skipped\n" + |
| 9910 |
" new AndSyncInfoFilter(new FastSyncInfoFilter[] {\n" + |
| 9911 |
" FastSyncInfoFilter.getDirectionAndChangeFilter(\n" + |
| 9912 |
" SyncInfo.CONFLICTING, SyncInfo.CHANGE),\n" + |
| 9913 |
" new FastSyncInfoFilter() {\n" + |
| 9914 |
" public boolean select(SyncInfo info) {\n" + |
| 9915 |
" IResource local = info.getLocal();\n" + |
| 9916 |
" if (local.getType() == IResource.FILE) {\n" + |
| 9917 |
" try {\n" + |
| 9918 |
" ICVSFile file = CVSWorkspaceRoot\n" + |
| 9919 |
" .getCVSFileFor((IFile) local);\n" + |
| 9920 |
" byte[] syncBytes = file.getSyncBytes();\n" + |
| 9921 |
" if (syncBytes != null) {\n" + |
| 9922 |
" return ResourceSyncInfo\n" + |
| 9923 |
" .isBinary(syncBytes);\n" + |
| 9924 |
" }\n" + |
| 9925 |
" } catch (CVSException e) {\n" + |
| 9926 |
" // There was an error obtaining or\n" + |
| 9927 |
" // interpreting the sync bytes\n" + |
| 9928 |
" // Log it and skip the file\n" + |
| 9929 |
" CVSProviderPlugin.log(e);\n" + |
| 9930 |
" return true;\n" + |
| 9931 |
" }\n" + |
| 9932 |
" }\n" + |
| 9933 |
" return false;\n" + |
| 9934 |
" }\n" + |
| 9935 |
" }\n" + |
| 9936 |
" }),\n" + |
| 9937 |
" // Outgoing changes may not fail but they are skipped as well\n" + |
| 9938 |
" new SyncInfoDirectionFilter(SyncInfo.OUTGOING)\n" + |
| 9939 |
" });\n" + |
| 9940 |
" }\n" + |
| 9941 |
"}\n" |
| 9942 |
); |
| 9943 |
} |
| 9944 |
public void testBug330313_wksp1_53_njl_bnl() { |
| 9945 |
this.formatterPrefs.join_wrapped_lines = false; |
| 9946 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 9947 |
String source = |
| 9948 |
"package wksp1;\n" + |
| 9949 |
"\n" + |
| 9950 |
"public class X53 {\n" + |
| 9951 |
" static final short[][][] BLACK_CODE = {\n" + |
| 9952 |
" /* 9 bits */\n" + |
| 9953 |
" {{24, 15}},\n" + |
| 9954 |
" /* 10 bits */\n" + |
| 9955 |
" {{8, 18}, {15, 64}, {23, 16}, {24, 17}, {55, 0}},\n" + |
| 9956 |
" /* 11 bits */\n" + |
| 9957 |
" {/* EOL */{0, -1}, {8, 1792}, {23, 24}, {24, 25}, {40, 23}, {55, 22}, {103, 19},\n" + |
| 9958 |
" {104, 20}, {108, 21}, {12, 1856}, {13, 1920}},\n" + |
| 9959 |
" };\n" + |
| 9960 |
"}\n"; |
| 9961 |
formatSource(source , |
| 9962 |
"package wksp1;\n" + |
| 9963 |
"\n" + |
| 9964 |
"public class X53\n" + |
| 9965 |
"{\n" + |
| 9966 |
" static final short[][][] BLACK_CODE =\n" + |
| 9967 |
" {\n" + |
| 9968 |
" /* 9 bits */\n" + |
| 9969 |
" {\n" + |
| 9970 |
" { 24, 15 } },\n" + |
| 9971 |
" /* 10 bits */\n" + |
| 9972 |
" {\n" + |
| 9973 |
" { 8, 18 },\n" + |
| 9974 |
" { 15, 64 },\n" + |
| 9975 |
" { 23, 16 },\n" + |
| 9976 |
" { 24, 17 },\n" + |
| 9977 |
" { 55, 0 } },\n" + |
| 9978 |
" /* 11 bits */\n" + |
| 9979 |
" {/* EOL */\n" + |
| 9980 |
" { 0, -1 },\n" + |
| 9981 |
" { 8, 1792 },\n" + |
| 9982 |
" { 23, 24 },\n" + |
| 9983 |
" { 24, 25 },\n" + |
| 9984 |
" { 40, 23 },\n" + |
| 9985 |
" { 55, 22 },\n" + |
| 9986 |
" { 103, 19 },\n" + |
| 9987 |
" { 104, 20 },\n" + |
| 9988 |
" { 108, 21 },\n" + |
| 9989 |
" { 12, 1856 },\n" + |
| 9990 |
" { 13, 1920 } },\n" + |
| 9991 |
" };\n" + |
| 9992 |
"}\n" |
| 9993 |
); |
| 9994 |
} |
| 9995 |
public void testBug330313_wksp2_01 () { |
| 9996 |
String source = |
| 9997 |
"package wksp2;\n" + |
| 9998 |
"\n" + |
| 9999 |
"public class X01 {\n" + |
| 10000 |
"\n" + |
| 10001 |
" static final Object[][] contents = {\n" + |
| 10002 |
" // comment\n" + |
| 10003 |
" { \"STR1\",\n" + |
| 10004 |
" // comment\n" + |
| 10005 |
" new String[] { \"STR\", // comment\n" + |
| 10006 |
" \"STR\", // comment\n" + |
| 10007 |
" \"STR\"} // comment\n" + |
| 10008 |
" }\n" + |
| 10009 |
"\n" + |
| 10010 |
" };\n" + |
| 10011 |
"\n" + |
| 10012 |
"}\n"; |
| 10013 |
formatSource(source, |
| 10014 |
"package wksp2;\n" + |
| 10015 |
"\n" + |
| 10016 |
"public class X01 {\n" + |
| 10017 |
"\n" + |
| 10018 |
" static final Object[][] contents = {\n" + |
| 10019 |
" // comment\n" + |
| 10020 |
" { \"STR1\",\n" + |
| 10021 |
" // comment\n" + |
| 10022 |
" new String[] { \"STR\", // comment\n" + |
| 10023 |
" \"STR\", // comment\n" + |
| 10024 |
" \"STR\" } // comment\n" + |
| 10025 |
" }\n" + |
| 10026 |
"\n" + |
| 10027 |
" };\n" + |
| 10028 |
"\n" + |
| 10029 |
"}\n" |
| 10030 |
); |
| 10031 |
} |
| 10032 |
public void testBug330313_wksp3_X01_njl() { |
| 10033 |
this.formatterPrefs.join_wrapped_lines = false; |
| 10034 |
String source = |
| 10035 |
"package wksp3;\n" + |
| 10036 |
"\n" + |
| 10037 |
"public class X01 {\n" + |
| 10038 |
" private static final String foo[][] = {\n" + |
| 10039 |
" // line 1\n" + |
| 10040 |
" // line 2\n" + |
| 10041 |
" {\"A\", \"B\", \"C\", \"D\", \"E\"} // comment\n" + |
| 10042 |
" };\n" + |
| 10043 |
"}\n"; |
| 10044 |
formatSource(source , |
| 10045 |
"package wksp3;\n" + |
| 10046 |
"\n" + |
| 10047 |
"public class X01 {\n" + |
| 10048 |
" private static final String foo[][] = {\n" + |
| 10049 |
" // line 1\n" + |
| 10050 |
" // line 2\n" + |
| 10051 |
" { \"A\", \"B\", \"C\", \"D\", \"E\" } // comment\n" + |
| 10052 |
" };\n" + |
| 10053 |
"}\n" |
| 10054 |
); |
| 10055 |
} |
| 10056 |
// Test cases added from bug 286601 |
| 10057 |
public void testBug330313_b286601_04() { |
| 10058 |
this.formatterPrefs.join_wrapped_lines = false; |
| 10059 |
this.formatterPrefs.alignment_for_expressions_in_array_initializer = Alignment.M_ONE_PER_LINE_SPLIT; |
| 10060 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 10061 |
String source = |
| 10062 |
"package b286601;\n" + |
| 10063 |
"\n" + |
| 10064 |
"public class X04 {\n" + |
| 10065 |
"\n" + |
| 10066 |
" \n" + |
| 10067 |
" // Table to merge access modes for condition statements (e.g branch[x] || branch[y]). \n" + |
| 10068 |
" private static final int[][] ACCESS_MODE_CONDITIONAL_TABLE= {\n" + |
| 10069 |
" /* UNUSED READ READ_POTENTIAL WRTIE WRITE_POTENTIAL UNKNOWN */\n" + |
| 10070 |
" /* UNUSED */ { UNUSED, READ_POTENTIAL, READ_POTENTIAL, WRITE_POTENTIAL, WRITE_POTENTIAL, UNKNOWN },\n" + |
| 10071 |
" /* READ */ { READ_POTENTIAL, READ, READ_POTENTIAL, UNKNOWN, UNKNOWN, UNKNOWN },\n" + |
| 10072 |
" /* READ_POTENTIAL */ { READ_POTENTIAL, READ_POTENTIAL, READ_POTENTIAL, UNKNOWN, UNKNOWN, UNKNOWN },\n" + |
| 10073 |
" /* WRITE */ { WRITE_POTENTIAL, UNKNOWN, UNKNOWN, WRITE, WRITE_POTENTIAL, UNKNOWN },\n" + |
| 10074 |
" /* WRITE_POTENTIAL */ { WRITE_POTENTIAL, UNKNOWN, UNKNOWN, WRITE_POTENTIAL, WRITE_POTENTIAL, UNKNOWN },\n" + |
| 10075 |
" /* UNKNOWN */ { UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN }\n" + |
| 10076 |
" };\n" + |
| 10077 |
"\n" + |
| 10078 |
"}\n"; |
| 10079 |
formatSource(source, |
| 10080 |
"package b286601;\n" + |
| 10081 |
"\n" + |
| 10082 |
"public class X04\n" + |
| 10083 |
"{\n" + |
| 10084 |
"\n" + |
| 10085 |
" // Table to merge access modes for condition statements (e.g branch[x] ||\n" + |
| 10086 |
" // branch[y]).\n" + |
| 10087 |
" private static final int[][] ACCESS_MODE_CONDITIONAL_TABLE =\n" + |
| 10088 |
" {\n" + |
| 10089 |
" /* UNUSED READ READ_POTENTIAL WRTIE WRITE_POTENTIAL UNKNOWN */\n" + |
| 10090 |
" /* UNUSED */{\n" + |
| 10091 |
" UNUSED,\n" + |
| 10092 |
" READ_POTENTIAL,\n" + |
| 10093 |
" READ_POTENTIAL,\n" + |
| 10094 |
" WRITE_POTENTIAL,\n" + |
| 10095 |
" WRITE_POTENTIAL,\n" + |
| 10096 |
" UNKNOWN },\n" + |
| 10097 |
" /* READ */{\n" + |
| 10098 |
" READ_POTENTIAL,\n" + |
| 10099 |
" READ,\n" + |
| 10100 |
" READ_POTENTIAL,\n" + |
| 10101 |
" UNKNOWN,\n" + |
| 10102 |
" UNKNOWN,\n" + |
| 10103 |
" UNKNOWN },\n" + |
| 10104 |
" /* READ_POTENTIAL */{\n" + |
| 10105 |
" READ_POTENTIAL,\n" + |
| 10106 |
" READ_POTENTIAL,\n" + |
| 10107 |
" READ_POTENTIAL,\n" + |
| 10108 |
" UNKNOWN,\n" + |
| 10109 |
" UNKNOWN,\n" + |
| 10110 |
" UNKNOWN },\n" + |
| 10111 |
" /* WRITE */{\n" + |
| 10112 |
" WRITE_POTENTIAL,\n" + |
| 10113 |
" UNKNOWN,\n" + |
| 10114 |
" UNKNOWN,\n" + |
| 10115 |
" WRITE,\n" + |
| 10116 |
" WRITE_POTENTIAL,\n" + |
| 10117 |
" UNKNOWN },\n" + |
| 10118 |
" /* WRITE_POTENTIAL */{\n" + |
| 10119 |
" WRITE_POTENTIAL,\n" + |
| 10120 |
" UNKNOWN,\n" + |
| 10121 |
" UNKNOWN,\n" + |
| 10122 |
" WRITE_POTENTIAL,\n" + |
| 10123 |
" WRITE_POTENTIAL,\n" + |
| 10124 |
" UNKNOWN },\n" + |
| 10125 |
" /* UNKNOWN */{ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN }\n" + |
| 10126 |
// Should be slip but that has been broken since 3.4.2 (i.e. 3.3.2 is OK) |
| 10127 |
// " /* UNKNOWN */{\n" + |
| 10128 |
// " UNKNOWN,\n" + |
| 10129 |
// " UNKNOWN,\n" + |
| 10130 |
// " UNKNOWN,\n" + |
| 10131 |
// " UNKNOWN,\n" + |
| 10132 |
// " UNKNOWN,\n" + |
| 10133 |
// " UNKNOWN }\n" + |
| 10134 |
" };\n" + |
| 10135 |
"\n" + |
| 10136 |
"}\n" |
| 10137 |
); |
| 10138 |
} |
| 10139 |
public void testBug330313_b286601_05() { |
| 10140 |
this.formatterPrefs.join_wrapped_lines = false; |
| 10141 |
this.formatterPrefs.alignment_for_expressions_in_array_initializer = Alignment.M_ONE_PER_LINE_SPLIT; |
| 10142 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 10143 |
String source = |
| 10144 |
"package b286601;\n" + |
| 10145 |
"\n" + |
| 10146 |
"public class X05 {\n" + |
| 10147 |
"\n" + |
| 10148 |
" \n" + |
| 10149 |
" // Table to merge access modes for condition statements (e.g branch[x] || branch[y]). \n" + |
| 10150 |
" static final String[][] ACCESS_MODE_CONDITIONAL_TABLE= {\n" + |
| 10151 |
" { \"UNUSED\", \"READ_POTENTIAL\", \"READ_POTENTIAL\", \"WRITE_POTENTIAL\", \"WRITE_POTENTIAL\", \"UNKNOWN\" },\n" + |
| 10152 |
" { \"READ_POTENTIAL\", \"READ\", \"READ_POTENTIAL\", \"UNKNOWN\", \"UNKNOWN\", \"UNKNOWN\" },\n" + |
| 10153 |
" };\n" + |
| 10154 |
"\n" + |
| 10155 |
"}\n"; |
| 10156 |
formatSource(source, |
| 10157 |
"package b286601;\n" + |
| 10158 |
"\n" + |
| 10159 |
"public class X05\n" + |
| 10160 |
"{\n" + |
| 10161 |
"\n" + |
| 10162 |
" // Table to merge access modes for condition statements (e.g branch[x] ||\n" + |
| 10163 |
" // branch[y]).\n" + |
| 10164 |
" static final String[][] ACCESS_MODE_CONDITIONAL_TABLE =\n" + |
| 10165 |
" {\n" + |
| 10166 |
" {\n" + |
| 10167 |
" \"UNUSED\",\n" + |
| 10168 |
" \"READ_POTENTIAL\",\n" + |
| 10169 |
" \"READ_POTENTIAL\",\n" + |
| 10170 |
" \"WRITE_POTENTIAL\",\n" + |
| 10171 |
" \"WRITE_POTENTIAL\",\n" + |
| 10172 |
" \"UNKNOWN\" },\n" + |
| 10173 |
" {\n" + |
| 10174 |
" \"READ_POTENTIAL\",\n" + |
| 10175 |
" \"READ\",\n" + |
| 10176 |
" \"READ_POTENTIAL\",\n" + |
| 10177 |
" \"UNKNOWN\",\n" + |
| 10178 |
" \"UNKNOWN\",\n" + |
| 10179 |
" \"UNKNOWN\" },\n" + |
| 10180 |
" };\n" + |
| 10181 |
"\n" + |
| 10182 |
"}\n" |
| 10183 |
); |
| 10184 |
} |
| 10185 |
public void testBug330313_b286601_06() { |
| 10186 |
this.formatterPrefs.join_wrapped_lines = false; |
| 10187 |
this.formatterPrefs.alignment_for_expressions_in_array_initializer = Alignment.M_ONE_PER_LINE_SPLIT; |
| 10188 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 10189 |
String source = |
| 10190 |
"package b286601;\n" + |
| 10191 |
"\n" + |
| 10192 |
"public class X06 {\n" + |
| 10193 |
"\n" + |
| 10194 |
" \n" + |
| 10195 |
" // Table to merge access modes for condition statements (e.g branch[x] || branch[y]). \n" + |
| 10196 |
" static final String[][] ACCESS_MODE_CONDITIONAL_TABLE= {\n" + |
| 10197 |
" /* Comment 1 */\n" + |
| 10198 |
" /* Comment 2 */ { \"UNUSED\", \"READ_POTENTIAL\", \"READ_POTENTIAL\", \"WRITE_POTENTIAL\", \"WRITE_POTENTIAL\", \"UNKNOWN\" },\n" + |
| 10199 |
" /* Comment 3 */ { \"READ_POTENTIAL\", \"READ\", \"READ_POTENTIAL\", \"UNKNOWN\", \"UNKNOWN\", \"UNKNOWN\" },\n" + |
| 10200 |
" };\n" + |
| 10201 |
"\n" + |
| 10202 |
"}\n"; |
| 10203 |
formatSource(source, |
| 10204 |
"package b286601;\n" + |
| 10205 |
"\n" + |
| 10206 |
"public class X06\n" + |
| 10207 |
"{\n" + |
| 10208 |
"\n" + |
| 10209 |
" // Table to merge access modes for condition statements (e.g branch[x] ||\n" + |
| 10210 |
" // branch[y]).\n" + |
| 10211 |
" static final String[][] ACCESS_MODE_CONDITIONAL_TABLE =\n" + |
| 10212 |
" {\n" + |
| 10213 |
" /* Comment 1 */\n" + |
| 10214 |
" /* Comment 2 */{\n" + |
| 10215 |
" \"UNUSED\",\n" + |
| 10216 |
" \"READ_POTENTIAL\",\n" + |
| 10217 |
" \"READ_POTENTIAL\",\n" + |
| 10218 |
" \"WRITE_POTENTIAL\",\n" + |
| 10219 |
" \"WRITE_POTENTIAL\",\n" + |
| 10220 |
" \"UNKNOWN\" },\n" + |
| 10221 |
" /* Comment 3 */{\n" + |
| 10222 |
" \"READ_POTENTIAL\",\n" + |
| 10223 |
" \"READ\",\n" + |
| 10224 |
" \"READ_POTENTIAL\",\n" + |
| 10225 |
" \"UNKNOWN\",\n" + |
| 10226 |
" \"UNKNOWN\",\n" + |
| 10227 |
" \"UNKNOWN\" },\n" + |
| 10228 |
" };\n" + |
| 10229 |
"\n" + |
| 10230 |
"}\n" |
| 10231 |
); |
| 10232 |
} |
| 10233 |
public void testBug330313_b286601_07() { |
| 10234 |
this.formatterPrefs.join_wrapped_lines = false; |
| 10235 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; |
| 10236 |
this.formatterPrefs.alignment_for_expressions_in_array_initializer = Alignment.M_ONE_PER_LINE_SPLIT; |
| 10237 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 10238 |
String source = |
| 10239 |
"package b286601;\n" + |
| 10240 |
"\n" + |
| 10241 |
"public class X07 {\n" + |
| 10242 |
"\n" + |
| 10243 |
" \n" + |
| 10244 |
" // Table to merge access modes for condition statements (e.g branch[x] || branch[y]). \n" + |
| 10245 |
" static final String[][] ACCESS_MODE_CONDITIONAL_TABLE= {\n" + |
| 10246 |
" /* Comment 1 */\n" + |
| 10247 |
" /* Comment 2 */ { \"1234567890123456789012345678901234567890\", \"1234567890123456789012345678901234567890\" },\n" + |
| 10248 |
" /* Comment 3 */ { \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\" },\n" + |
| 10249 |
" };\n" + |
| 10250 |
"\n" + |
| 10251 |
"}\n"; |
| 10252 |
formatSource(source, |
| 10253 |
"package b286601;\n" + |
| 10254 |
"\n" + |
| 10255 |
"public class X07\n" + |
| 10256 |
"{\n" + |
| 10257 |
"\n" + |
| 10258 |
" // Table to merge access modes for condition statements (e.g branch[x] ||\n" + |
| 10259 |
" // branch[y]).\n" + |
| 10260 |
" static final String[][] ACCESS_MODE_CONDITIONAL_TABLE =\n" + |
| 10261 |
" {\n" + |
| 10262 |
" /* Comment 1 */\n" + |
| 10263 |
" /* Comment 2 */{\n" + |
| 10264 |
" \"1234567890123456789012345678901234567890\",\n" + |
| 10265 |
" \"1234567890123456789012345678901234567890\" },\n" + |
| 10266 |
" /* Comment 3 */{\n" + |
| 10267 |
" \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\",\n" + |
| 10268 |
" \"ABCDEFGHIJKLMNOPQRSTUVWXYZ______________\" },\n" + |
| 10269 |
" };\n" + |
| 10270 |
"\n" + |
| 10271 |
"}\n" |
| 10272 |
); |
| 10273 |
} |
| 10274 |
public void testBug330313_b286601_08() { |
| 10275 |
this.formatterPrefs.join_wrapped_lines = false; |
| 10276 |
this.formatterPrefs.alignment_for_expressions_in_array_initializer = Alignment.M_ONE_PER_LINE_SPLIT; |
| 10277 |
setUpBracesPreferences(DefaultCodeFormatterConstants.NEXT_LINE); |
| 10278 |
String source = |
| 10279 |
"package b286601;\n" + |
| 10280 |
"\n" + |
| 10281 |
"public class X08 {\n" + |
| 10282 |
" private MinimizedFileSystemElement selectFiles(final Object rootFileSystemObject, final IImportStructureProvider structureProvider) {\n" + |
| 10283 |
"\n" + |
| 10284 |
" BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {\n" + |
| 10285 |
" public void run() {\n" + |
| 10286 |
" //Create the root element from the supplied file system object\n" + |
| 10287 |
" }\n" + |
| 10288 |
" });\n" + |
| 10289 |
"\n" + |
| 10290 |
" return null;\n" + |
| 10291 |
" }\n" + |
| 10292 |
"}\n"; |
| 10293 |
formatSource(source, |
| 10294 |
"package b286601;\n" + |
| 10295 |
"\n" + |
| 10296 |
"public class X08\n" + |
| 10297 |
"{\n" + |
| 10298 |
" private MinimizedFileSystemElement selectFiles(\n" + |
| 10299 |
" final Object rootFileSystemObject,\n" + |
| 10300 |
" final IImportStructureProvider structureProvider)\n" + |
| 10301 |
" {\n" + |
| 10302 |
"\n" + |
| 10303 |
" BusyIndicator.showWhile(getShell().getDisplay(), new Runnable()\n" + |
| 10304 |
" {\n" + |
| 10305 |
" public void run()\n" + |
| 10306 |
" {\n" + |
| 10307 |
" // Create the root element from the supplied file system object\n" + |
| 10308 |
" }\n" + |
| 10309 |
" });\n" + |
| 10310 |
"\n" + |
| 10311 |
" return null;\n" + |
| 10312 |
" }\n" + |
| 10313 |
"}\n" |
| 10314 |
); |
| 10315 |
} |
| 10316 |
|
| 10317 |
/** |
| 7633 |
* @bug 332818: [formatter] Java formatter, Blank Lines tab, only 1st line indented when multiple lines is set |
10318 |
* @bug 332818: [formatter] Java formatter, Blank Lines tab, only 1st line indented when multiple lines is set |
| 7634 |
* @test Ensure that the indentation is set on all blank lines |
10319 |
* @test Ensure that the indentation is set on all blank lines |
| 7635 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=332818" |
10320 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=332818" |