Re: Eclipse _mthclass$ problem

From: Emir Alikadic (ealikadic_at_collectivebid.com)
Date: 01/30/04


Date: Fri, 30 Jan 2004 11:40:18 -0500


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 28/01/2004 6:03 PM, Monkeyshyne wrote:

> I have an issue with Eclipse not adding a static Class called
> _mthclass$ to my compiled class file and when I compile the same
> source using Ant with jdk 1.3 or 1.4 it adds this _mthclass$. I read
> that Eclipse has its own javac to compile class files and that you
> cannot change this. My classes are now incompatible during
> Serialization. Has anyone come across a way to get Eclipse to add this
> class or a work around?

Eclipse does indeed have its own compiler that is an independent
implementation of the spec. This means that bugs in Sun's implementation may
not necessarily appear in Eclipse and vice versa, as
https://bugs.eclipse.org/bugs/show_bug.cgi?id=37565 illustrates (Sun's Javac
was triggering a class initialization upon encountering a class literal,
whereas the spec says it shouldn't; Eclipse compiler was following the spec
which caused errors in code that relied on buggy Sun implementation).

One workaround is to make sure you use same compiler on both ends. If you
decide to use Sun's javac, you need to use Ant within Eclipse (right-click on
build.xml in Package Explorer and select Run Ant) which will use javac from
whatever J2SE SDK you have currently selected. Selecting Project -> Build
Project/All in the menu will use the internal Eclipse compiler.
- --
Emir Alikadic
Software Developer
CollectiveBid Systems Inc.

"If you think technology can solve your problems, then you don't understand
 your problems and you don't understand technology." [Bruce Schneier]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)

iD8DBQFAGojyuSy542G+Z7QRAhHEAJ0ftISBihldJ74ut5Vg9eWAB2WBiwCfTLMU
HxF+G7umGCPzPztMAoQVj6U=
=6x8k
-----END PGP SIGNATURE-----



Relevant Pages

  • Re: Improving String.equals() implementation
    ... Eclipse, and it never let me off the hook for using javac. ... and the compiler's reliance on interning Strings ... I refer to any brand of compiler as "javac". ...
    (comp.lang.java.programmer)
  • Re: why is var superValue not getting initialized to 911 in this code
    ... That would explain why I got no warning whatsoever from ... The distinction between Eclipse and compiler is a bit fuzzy ... Well, normally when one refers to 'javac' explicitly, it refers to one ...
    (comp.lang.java.programmer)
  • Re: why is var superValue not getting initialized to 911 in this code
    ... That would explain why I got no warning whatsoever from ... The distinction between Eclipse and compiler is a bit fuzzy ... Well, normally when one refers to 'javac' explicitly, it refers to one ...
    (comp.lang.java.programmer)
  • Re: Improving String.equals() implementation
    ... How does being an Eclipse user allow one not to use javac? ... Eclipse uses its own compiler technology. ... and the compiler's reliance on interning Strings ...
    (comp.lang.java.programmer)
  • Re: Visual C++ 6 support issue
    ... Of course, Eclipse has the ... simpler syntax than C++ and is much easier to parse and analyse. ... A C++ compiler is quite a tricky beast to write (which is ... preprocessor symbols and language symbols (and of language symbols ...
    (microsoft.public.vc.mfc)