Community
Participate
Working Groups
I20061129-1340 Pasting source should handle more than one public type. Currently only one CU is generated which results in compile errors. NOTE: must also consider enums.
It should already work if you have package statements before each public type. So I'm not sure what you're missing.
paste this: public class foo { } public class bar { } ==> compile error
Not trivial, since we cannot simply start a new CU for each occurrence of keyword "package". Would have to deal with import startements as well, which is even less clear in cases like this: import java.util.Vector; public class foo { } public class bar { } => Does the import statement belong to the foo alone, or to foo and bar? Do we have to support variants with an additional import structure between foo and bar as well? I think this will quickly become unpredictable and thus useless for the most common use case (paste code from bugzilla to reproduce a problem from a clearly defined starting state). I don't think we should support this. Please add your vote to bug 87085.
Dani seems to have different common use cases than I have :-). Reopening to support these cases (split text at //--, never repeat import structure from earlier declaration): public class A {} //-- public class B {} ------------------------------------------- import java.util.Vector public class A {} //-- public class B {} ------------------------------------------- import java.util.Vector public class A {} //-- import java.util.Map public class B {}