KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm getting an anonymous class at compile-time that I'm not expecting. Relevant code follows, then a more detailed explanation: Entirety of CircuitType.java: public enum CircuitType { V110A20, V110A30, V208A20, V208A30 } From Auditor.java, lines 3-9: public class Auditor { private String[] fileNames; private int numV110A20; private int numV110A30; private int numV208A20; private int numV208A30; From Auditor.java, lines 104-121: [...] switch (newCircuit.getType()) { case V110A20: this.numV110A20++; break; case V110A30: this.numV110A30++; break; case V208A20: this.numV208A20++; break; case V208A30: this.numV208A30++; break; default: System.err.println("An Error Has Occured."); System.exit(-1); break; } [...] From Circuit.java, lines 1-5: public class Circuit { private CircuitType myType; public CircuitType getType() { return this.myType; } [...] When the command javac *.java is executed, an anonymous class Auditor$1.java is generated. The files, obviously, all sit next to each other in a file system directory that contains nothing else. When lines 104-121 are commented out, no anonymous class is generated. I at first thought it was a package issue, so put the three classes in a package, but I didn't know enough about packages to get it working. If it's truely a package issue, can someone step me through exactly how to label them? I'd rather not have to package them if I don't have to, though. The reason the anonymous class is a problem, besides the fact that such classes usually signify a namespace issue, is that it breaks my Makefile I use for automatic compilation. Update Attached
Tags (comma-separated)
Save Edits
Cancel