Compiler mystery: Compiles classes that don't compile
- From: peeping_t@xxxxxxxxxxx
- Date: 28 Feb 2006 14:09:32 -0800
Can someone please try and explain how this could even happen.
I'm about to start fixing some bugs in a program for a client. They
haven't really been that organised and just gave me some source code
from somewhere, which may or may not be the version of the source code
that was used to compile the version of the app that I am supposed to
fix bugs in.
Now to the problem. The code doesn't even compile. There's a file
Container.java, which is missing heaps of methods (private ones I guess
as they are only called from inside Container). I decompiled the actual
application and when I look at Container every single method that calls
one of the missing methods are decompiled to something similar like
this
public void open()
{
throw new Error("Unresolved compilation problems:\n\tThe method
initMenu() is undefined for the type Container\n\tThe method handle()
is undefined for the type <anonymous subclass of
SelectionAdapter>\n\tThe method loadSettings() is undefined for the
type Container\n\tThe method init() is undefined for the type
Container\n\tThe constructor Blue(Container) is undefined\n");
}
I don't understand how the compiler managed to compile this class and
replace the method body for the methods calling missing methods with
throw new Error("Unresolved...")
The thing is the application still works as Container is only
referenced as Container.class.getResourceAsStream(...)
The previous programmer was obviously doing some heavy refactoring to
get rid of the Container class, but managed to miss a couple of places
where the class was just referenced as Container.class
I still don't get how the compiler managed to produce a Container.class
file though
/Martin
.
- Follow-Ups:
- Re: Compiler mystery: Compiles classes that don't compile
- From: Oliver Wong
- Re: Compiler mystery: Compiles classes that don't compile
- Prev by Date: Re: program works but wont display in browser
- Next by Date: Re: Compiler mystery: Compiles classes that don't compile
- Previous by thread: Tomcat 3 -- servlet reload issue -- pls help..
- Next by thread: Re: Compiler mystery: Compiles classes that don't compile
- Index(es):
Relevant Pages
|