Lines 779-785
Link Here
|
779 |
env.setBuildOrder(null); |
779 |
env.setBuildOrder(null); |
780 |
} |
780 |
} |
781 |
} |
781 |
} |
782 |
|
782 |
|
|
|
783 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=114349 |
784 |
// this one fails; compare with testCycle7 (only one change in Object source), |
785 |
// which passes |
786 |
public void testCycle6() throws JavaModelException { |
787 |
Hashtable options = JavaCore.getOptions(); |
788 |
Hashtable newOptions = JavaCore.getOptions(); |
789 |
newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); |
790 |
|
791 |
JavaCore.setOptions(newOptions); |
792 |
|
793 |
//---------------------------- |
794 |
// Project1 |
795 |
//---------------------------- |
796 |
IPath p1 = env.addProject("P1"); |
797 |
// remove old package fragment root so that names don't collide |
798 |
env.removePackageFragmentRoot(p1, ""); |
799 |
IPath root1 = env.addPackageFragmentRoot(p1, "src"); |
800 |
env.setOutputFolder(p1, "bin"); |
801 |
|
802 |
env.addClass(root1, "java/lang", "Object", |
803 |
"package java.lang;\n" + |
804 |
"public class Object {\n" + |
805 |
" Class getClass() { return null; }\n" + |
806 |
" String toString() { return \"\"; }\n" + // the line that changes |
807 |
"}\n" |
808 |
); |
809 |
|
810 |
//---------------------------- |
811 |
// Project2 |
812 |
//---------------------------- |
813 |
IPath p2 = env.addProject("P2"); |
814 |
// remove old package fragment root so that names don't collide |
815 |
env.removePackageFragmentRoot(p2, ""); |
816 |
IPath root2 = env.addPackageFragmentRoot(p2, "src"); |
817 |
env.setOutputFolder(p2, "bin"); |
818 |
|
819 |
env.addClass(root2, "java/lang", "Class", |
820 |
"package java.lang;\n" + |
821 |
"public class Class {\n" + |
822 |
" String getName() { return \"\"; };\n" + |
823 |
"}\n" |
824 |
); |
825 |
|
826 |
//---------------------------- |
827 |
// Project3 |
828 |
//---------------------------- |
829 |
IPath p3 = env.addProject("P3"); |
830 |
// remove old package fragment root so that names don't collide |
831 |
env.removePackageFragmentRoot(p3, ""); |
832 |
IPath root3 = env.addPackageFragmentRoot(p3, "src"); |
833 |
env.setOutputFolder(p3, "bin"); |
834 |
|
835 |
env.addClass(root3, "java/lang", "String", |
836 |
"package java.lang;\n" + |
837 |
"public class String {\n" + |
838 |
"}\n" |
839 |
); |
840 |
|
841 |
// Dependencies |
842 |
IPath[] accessiblePaths = new IPath[] {new Path("java/lang/*")}; |
843 |
IPath[] forbiddenPaths = new IPath[] {new Path("**/*")}; |
844 |
env.addRequiredProject(p1, p2, accessiblePaths, forbiddenPaths, false); |
845 |
env.addRequiredProject(p1, p3, accessiblePaths, forbiddenPaths, false); |
846 |
env.addRequiredProject(p2, p1, accessiblePaths, forbiddenPaths, false); |
847 |
env.addRequiredProject(p2, p3, accessiblePaths, forbiddenPaths, false); |
848 |
env.addRequiredProject(p3, p1, accessiblePaths, forbiddenPaths, false); |
849 |
env.addRequiredProject(p3, p2, accessiblePaths, forbiddenPaths, false); |
850 |
|
851 |
try { |
852 |
fullBuild(); |
853 |
|
854 |
expectingOnlySpecificProblemsFor(p1,new Problem[]{ |
855 |
new Problem("p1", "A cycle was detected in the build path of project: P1", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH)//$NON-NLS-1$ //$NON-NLS-2$ |
856 |
}); |
857 |
expectingOnlySpecificProblemsFor(p2,new Problem[]{ |
858 |
new Problem("p2", "A cycle was detected in the build path of project: P2", p2, -1, -1, CategorizedProblem.CAT_BUILDPATH)//$NON-NLS-1$ //$NON-NLS-2$ |
859 |
}); |
860 |
expectingOnlySpecificProblemsFor(p3,new Problem[]{ |
861 |
new Problem("p3", "A cycle was detected in the build path of project: P3", p3, -1, -1, CategorizedProblem.CAT_BUILDPATH)//$NON-NLS-1$ //$NON-NLS-2$ |
862 |
}); |
863 |
|
864 |
} finally { |
865 |
JavaCore.setOptions(options); |
866 |
} |
867 |
} |
868 |
|
869 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=114349 |
870 |
// this one passes; compare with testCycle6 (only one change in Object source), |
871 |
// which fails |
872 |
public void testCycle7() throws JavaModelException { |
873 |
Hashtable options = JavaCore.getOptions(); |
874 |
Hashtable newOptions = JavaCore.getOptions(); |
875 |
newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); |
876 |
|
877 |
JavaCore.setOptions(newOptions); |
878 |
|
879 |
//---------------------------- |
880 |
// Project1 |
881 |
//---------------------------- |
882 |
IPath p1 = env.addProject("P1"); |
883 |
// remove old package fragment root so that names don't collide |
884 |
env.removePackageFragmentRoot(p1, ""); |
885 |
IPath root1 = env.addPackageFragmentRoot(p1, "src"); |
886 |
env.setOutputFolder(p1, "bin"); |
887 |
|
888 |
env.addClass(root1, "java/lang", "Object", |
889 |
"package java.lang;\n" + |
890 |
"public class Object {\n" + |
891 |
" Class getClass() { return null; }\n" + |
892 |
" String toString() { return null; }\n" + // the line that changes |
893 |
"}\n" |
894 |
); |
895 |
|
896 |
//---------------------------- |
897 |
// Project2 |
898 |
//---------------------------- |
899 |
IPath p2 = env.addProject("P2"); |
900 |
// remove old package fragment root so that names don't collide |
901 |
env.removePackageFragmentRoot(p2, ""); |
902 |
IPath root2 = env.addPackageFragmentRoot(p2, "src"); |
903 |
env.setOutputFolder(p2, "bin"); |
904 |
|
905 |
env.addClass(root2, "java/lang", "Class", |
906 |
"package java.lang;\n" + |
907 |
"public class Class {\n" + |
908 |
" String getName() { return \"\"; };\n" + |
909 |
"}\n" |
910 |
); |
911 |
|
912 |
//---------------------------- |
913 |
// Project3 |
914 |
//---------------------------- |
915 |
IPath p3 = env.addProject("P3"); |
916 |
// remove old package fragment root so that names don't collide |
917 |
env.removePackageFragmentRoot(p3, ""); |
918 |
IPath root3 = env.addPackageFragmentRoot(p3, "src"); |
919 |
env.setOutputFolder(p3, "bin"); |
920 |
|
921 |
env.addClass(root3, "java/lang", "String", |
922 |
"package java.lang;\n" + |
923 |
"public class String {\n" + |
924 |
"}\n" |
925 |
); |
926 |
|
927 |
// Dependencies |
928 |
IPath[] accessiblePaths = new IPath[] {new Path("java/lang/*")}; |
929 |
IPath[] forbiddenPaths = new IPath[] {new Path("**/*")}; |
930 |
env.addRequiredProject(p1, p2, accessiblePaths, forbiddenPaths, false); |
931 |
env.addRequiredProject(p1, p3, accessiblePaths, forbiddenPaths, false); |
932 |
env.addRequiredProject(p2, p1, accessiblePaths, forbiddenPaths, false); |
933 |
env.addRequiredProject(p2, p3, accessiblePaths, forbiddenPaths, false); |
934 |
env.addRequiredProject(p3, p1, accessiblePaths, forbiddenPaths, false); |
935 |
env.addRequiredProject(p3, p2, accessiblePaths, forbiddenPaths, false); |
936 |
|
937 |
try { |
938 |
fullBuild(); |
939 |
|
940 |
expectingOnlySpecificProblemsFor(p1,new Problem[]{ |
941 |
new Problem("p1", "A cycle was detected in the build path of project: P1", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH)//$NON-NLS-1$ //$NON-NLS-2$ |
942 |
}); |
943 |
expectingOnlySpecificProblemsFor(p2,new Problem[]{ |
944 |
new Problem("p2", "A cycle was detected in the build path of project: P2", p2, -1, -1, CategorizedProblem.CAT_BUILDPATH)//$NON-NLS-1$ //$NON-NLS-2$ |
945 |
}); |
946 |
expectingOnlySpecificProblemsFor(p3,new Problem[]{ |
947 |
new Problem("p3", "A cycle was detected in the build path of project: P3", p3, -1, -1, CategorizedProblem.CAT_BUILDPATH)//$NON-NLS-1$ //$NON-NLS-2$ |
948 |
}); |
949 |
|
950 |
} finally { |
951 |
JavaCore.setOptions(options); |
952 |
} |
953 |
} |
954 |
|
783 |
/* |
955 |
/* |
784 |
* Full buid case |
956 |
* Full buid case |
785 |
*/ |
957 |
*/ |