Compiler mystery: Compiles classes that don't compile



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

.



Relevant Pages

  • Re: Compiler mystery: Compiles classes that dont compile
    ... I'm about to start fixing some bugs in a program for a client. ... The code doesn't even compile. ... as they are only called from inside Container). ... one of the missing methods are decompiled to something similar like ...
    (comp.lang.java.help)
  • Re: kernel 2.6.1 and cdrecord on ATAPI bus
    ... > I believe that you will find that you have to compile for 2.6 on a ... This is free software; see the source for copying conditions. ... Report bugs using the `glibcbug' script to. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Sound stopped working after update
    ... these two bugs: ... compile alsa yourself from source. ... it is tagged as 'grave' and is in the sarge release path. ... >> affect the outcome of sound tests done afterwards? ...
    (Debian-User)
  • Re: D6 to Delphi 2006?
    ... There are a few changes in the VCL that might cause incompatibility ... and introduce bugs although the source will compile just fine. ...
    (borland.public.delphi.non-technical)
  • Re: Meanwhile, sounds like the unicode update is coming along ...
    ... There are cases where I've cursed the eff word at shortstring vs ansistring bugs... ... because everything "compiled" fine but the ansistrings were turned off, ... a shortstring will equally compile as an ansistring... ...
    (borland.public.delphi.non-technical)