Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: java.lang.IncompatibleClassChangeError: Implementing class Date: Sun, 13 Mar 2016 15:54:39 -0400 Organization: A noiseless patient Spider Lines: 35 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 13 Mar 2016 19:51:32 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="2d081e2f7155c28005d4472f67c2f43d"; logging-data="18831"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1898jv6R2XSzSfeqtOD1iZR" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: Cancel-Lock: sha1:1x5Fzh3+mOes3JcxEQWtWbcwlMA= Xref: csiph.com comp.lang.java.programmer:33953 On 3/13/2016 3:24 PM, mike wrote: > Hi, > > I posted this in the group mockito. > > https://groups.google.com/forum/#!topic/mockito/iJHYQEh9Z3I > > I ran the same test cases with maven and the old version of the mocked object. > That did not give "java.lang.IncompatibleClassChangeError: Implementing class" message. > > What I suspect is that I have done something in my mocked class that does not make it thread-safe anymore. Does it have to be in my mocked class or in the class it extends. To me the error message does not give me any pointers. Just guessing, because I've never encountered this particular error (nor do I use Maven), BUT it doesn't appear to me that lack of thread safety is a cause of the problem. The JVM Specification describes various causes of IncompatibleClassChangeError, and they all seem to be involved with troubles that arise while loading, linking, or initializing a class (or interface) that the JVM hasn't yet seen. If the error occurs so early in the class' life cycle, then none of the class' code has yet had a chance to execute -- so whatever bugs might lie in that code have not yet come into play. Still guessing (maybe "speculating" would be better): You mention an "old version" of your object, suggesting that there's more than one version floating around. And maybe there are multiple versions of some other classes in play, too. Could it be that Maven has an old version of class X in a cache somewhere, and that the old X is incompatible with the new Y you're trying to load? As I said: Just guessing. -- esosman@comcast-dot-net.invalid "Don't be afraid of work. Make work afraid of you." -- TLM