>From http://docs.oracle.com/javase/specs/jls/se5.0/html/binaryComp.html

"13.4.26 Evolution of Enums
Adding or reordering constants from an enum type will not break 
compatibility with pre-existing binaries.

If a precompiled binary attempts to access an enum constant that no longer 
exists, the client will fail at runtime with a NoSuchFieldError. Therefore 
such a change is not recommended for widely distributed enums.

In all other respects, the binary compatibility rules for enums are 
identical to those for classes."

So I think Ray is correct.
-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
[email protected]

office: +1 386 848 1781
mobile: +1 386 848 3788




From:   Neil Bartlett <[email protected]>
To:     Raymond Auge <[email protected]>, OSGi Developer Mail List 
<[email protected]>
Date:   2014/09/24 18:47
Subject:        Re: [osgi-dev] semantic versioning enums (and other new 
types)
Sent by:        [email protected]



I believe that adding values to an enum is NOT binary compatible, 
therefore it would be a major change. Any switch statements written 
against the old version will no longer be exhaustive after the addition of 
the new value. This could substantially alter the logic of any client 
code.

Neil

On 24 September 2014 at 23:34:10, Raymond Auge ([email protected]) 
wrote:
How do changes to enums affect versioning?

I believe, theoretically, adding values to be binary compatible, and 
should therefore constitute a MINOR api change.

Just making sure since this is not mentioned in the semver white paper.
--
Raymond Augé (@rotty3000) 
Senior Software Architect
Liferay, Inc. (@Liferay) 

_______________________________________________ 
OSGi Developer Mail List 
[email protected] 
https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to