Tuesday August 16, 2011 | Stephen Colebourne's Weblog Ideas and musings from a Java developer |
|
|
This blog has moved! I have moved the history of posts and comments from JRoller to the new location of blog.joda.org. However, I can't find a way to auto-redirect the feed.
Please resubscribe to the new blog using this feed: Sorry for the resubscribe inconvenience! ( Aug 16 2011, 12:51:59 PM BST ) PermalinkJoda-Time version 2.0 is now released! Download. Release notes. Firstly, Joda-Time 2.0 is NOT a re-write of Joda-Time. The major version number change signifies that there are some incompatibilities. However, these are as minor as I could make them. A few methods on Chronology that were deprecated for years have been removed, but most other deprecated and classes methods remain as the benefits of removing them were lower than the damage caused. The library has moved to JDK 1.5 compatibility, adding generics. Sadly, adding generics to Comparable in some cases caused issues for implementations. The choice was to aim for binary incompatibility at the expense of source incompatibility if the ReadableInstant or ReadableDuration interfaces were implemented directly. If you didn't implement these, or extended the supplied abstract class then you should have no problems. Similarly, ReadablePartial had Comparable added, but if you didn't implement it, or extended the supplied abstract class then again you should have no problems. In summary, I hope there are no significant binary incompatibilities. If you do find a binary incompatibility that I didn't, I'd like to know, particularly if it affects another open source project. If it is in the next week or so, then perhaps the incompatibility can be fixed and "jar hell" avoided. There are a number of semantic changes as well in the corner cases. Again see the release notes.
And of course there are some enhancements:
Hopefully, you can just drop Joda-Time into your application and you will not notice any change. However, you should definitely read the release notes first. Finally, as I'm sure someone will ask, this doesn't affect ThreeTen/JSR-310. This release was necessary to finally release a lot of bugs and enhancements in Joda-Time. PS. As a bonus, there is a re-release of the JSP tags library, as apparently it wasn't in maven central correctly up until now. PPS. For Hibernate 4.0 support, please use the usertype project. ( Aug 01 2011, 01:24:07 AM BST ) Permalink Comments [3]I can't write about Kotlin without first talking about the folly of "reversed" type declarations. Sadly this disease has afflicted Scala, Gosu and now Kotlin (but perhaps its not yet too late for Kotlin ;-). Reversed type declarationsWhen I see a new language, one of the first things I look at is the parameters and variable declarations. For this blog I'll refer to them as "standard" (like Java, Ceylon and Fantom) and "reversed" (like Pascal, Scala, Gosu and Kotlin). // standard Type variableName // reversed variableName : Type Here I compare a Java and Kotlin method, although the principle is similar for Gosu, Scala and quite a few others.
// Java
public void process(String str) { ... }
// Reversed lang (Kotlin or any similar language like Scala or Gosu)
fun process(str : String) { ... }
When I see the latter, I cringe. Its usually a sign that the language isn't going to win me over. So why the big deal? For a start, there is one extra syntax character, the colon. Given that this is unnecessary (as shown by Java), it continues to be surprising to me that languages that aim to be less verbose than Java begin with something that is more verbose. Ignoring the annoyance of having to type the extra character, the two examples above are still fundamentally readable. The human eye (specifically my human eye, but hey I'm being opinionated...) can cope with the extra colon and "reversed" declaration order. However, add complexity and the situation changes:
// Java
public void process(String str, int total, List<String> input) { ... }
// Reversed lang
fun process(str : String, total : int, input : List<String>) { ... }
As more parameters are added, the eye has more difficulty in picking out where one parameter ends and the next one starts. This is simply because the colon is more visually arresting than the comma, so as the eye scans the line it breaks up the parameters using the colons, not the commas. Thus at a glance I see "str", "String, total", "int, input", "List<String>". In fact, my eye sometimes doesn't see the commas at all, thus I get "str", "String total", "int input", "List<String>" which is horribly broken. In order to actually read the information, I have to slow down and take longer. But when designing a programming language, it is rapid and quick readability that matters. Slowing me down on reading is a Bad Thing. So, beyond being unnecessary, the extra colons are actually making the code significantly harder to read (and write!). But it gets worse:
// Java
public Future<Person> process(String str, List<String> input) { ... }
// Reversed lang
fun process(str : String, input : List<String>) : Future<Person> { ... }
Now, we have a return type, again separated by a colon. The use of the same character (yes that is another verbosity character I have to type) makes it especially difficult to visually parse. For me, the strength of the colon overrides the end bracket, thus I end up seeing "Future<Person>" as a parameter. Effectively my eye is parsing the line in a fraction of a second, but it gets to the end and has to double back to "push" the last thing it saw onto the "return type" stack. Try this one if you're struggling to see the issue. Note how the types and colons dominate and flow into one another, causing the distinctions as to their meaning (type of a parameter vs return type) to be lost:
fun process(a : Int, b : Int, c : Int) : Int { ... }
As an aside, lets look at default parameters, which many new languages support (using an equivalent syntax for Java):
// Java
public Future<Person> process(String str, List<String> input, int total = 0) { ... }
// Reversed lang
fun process(str : String, input : List<String>, total : Int = 0) : Future<Person> { ... }
Now it is really broken! Now I've got "Int = 0" staring me in the eye, which really is not what the programmer was trying to express. Again, that visual barrier of the colon, together with the type, makes it very hard to connect the actual parameter name "total" with the value it has "0". The real test for the syntax is the more complex case of higher order functions. This varies a lot by language, so lots of examples (hopefully accurate - I don't have time for lots of testing). I'm simulating some syntax for Java and Fantom:
// Java
public <T, R> List<R> transform(List<T> list, Transformer<T, R> transformer) { ... }
public <T, R> List<R> transform(List<T> list, #R(T) transformer) { ... } // lambda strawman
public <T, R> List<R> transform(List<T> list, {T => R} transformer) { ... } // BGGA
// Ceylon
shared List<R> transform<T, R>(List<T> list, R transformer(T)) { ... }
// Fantom
R[] transform<T, R>(T[] list, |T -> R| transformer) { ... } // simulated syntax
// Gosu
function transform<T, R>(list : List<T>, transformer(T) : R) : List<R> { ... }
// Kotlin
fun <T, R> transform(list : List<T>, transformer : fun(T) : R) : List<R> { ... }
// Scala
def transform[T, R](list : List[T], transformer: T => R) : List[R]
The Java strawman and BGGA examples and Fantom pseudo-example demonstrate that a form can be created where higher order declarations are possible using "standard" declarations. Ceylon chooses to go down the C style route, mixing the parameter name in the middle of the return type and arguments. I don't find Ceylon's choice as readable to my eye when scanning as the Strawman/BGGA/Fantom pseudo-examples because it mixes the type and the variable name. The three "reversed" declaration approaches are very different. Gosu (if I've read the documentation correctly) makes a very weird choice as the element after the colon is the return type of the function not the type of the variable "transformer" within the method as would be expected most of the time. Kotlin's choice is also poor, as it now means there are two colons in the parameter declaration, one to separate the variable name from the type, and one to separate the function type input from its output. Scala's is the most rational of the "reversed" declaration styles. However, I find the lack of anything surrounding the "T => R" means that the eye struggles to find the start and end of the type in more complex examples, which is essential to finding the variable name. Of these, the Strawman/BGGA/Fantom pseudo-examples and most readable of the first group and Scala in the second group (ignoring the real Java example for a minute, and noting that Scala would be clearer with something around the function type). That is because when I'm performing the eye parsing/scanning I've been talking about, I am essentially trying to grasp the signature. To do that I need to know the number of parameters, their names and their types. Specifically, I want to put the name and type into different mental boxes. Mixing the name and type as Ceylon and Gosu do makes that harder, while Kotlin's additional colon simply creates another fence for my eye to have to jump. To do this full justice, I should really have some examples of function types of function types. However this blog is already very long... Finally, I'll point out that this isn't just confined to method parameters, but also to variable declarations such as local variables. Again, this gets complicated between language in the detail, so I'll compare to a typical "reversed" type language using a braindead stupid example:
// Java
private String process(int total) {
String str = Integer.toString(total);
return str;
}
// Reversed lang
fun process(total : Int) : String {
val str : String = Integer.toString(total)
return str
}
Again, the "reversed" example is telling me that "String = ...", not "str = ...". In logical terms, its utterly broken. OK, OK, I can hear you yelling "type inference":
// Java
private String process(int total) {
val str = Integer.toString(total);
return str;
}
// Reversed lang
fun process(total : Int) : String {
val str = Integer.toString(total)
return str
}
So, I cheated right? By inventing a Java type inference syntax. Well, I'm making the point that type inference need not be limited to new languages, Java or any language using the "standard" type declaration style can have it too (and Fantom and Ceylon do). Thus, we should judge the variable declarations by the long form, even if it is not used for local variables all the time. And as shown above, the long form is awful in the "reversed" style. I am most emphatically not assigning the total to "String", I'm assigning it to "str", and that is what the code should say. I'm sure if you've read this far you have a number of comments. Perhaps you believe tooling solves the issue, maybe syntax colouring? Well, I'll simply say that while tooling helps, you should still be able to understand the language without it, even if just for command line diffs around a version control system. Or perhaps you're objecting to my methodology of trying to visually parse a line in a glance? Its how I work, don't you do scan code too? Let me be clear, in none of the above do I mention the task of the compiler. My sole focus is on the developer reading the code, and an order of magnitude less writing code. Any argument in support of "reversed" type declarations should never be based on relevance to the compiler or some other element of type theory. My view is that the usability to the mainstream developer is what matters. And that is primarily about ease of reading what is written. I have endeavoured to show that the reverse style hampers readability, and is unnecessary to achieve the same goals of a more complex type system that are sometimes used as justification. SummaryI'm arguing that the "reversed" type declaration style is flat out harder to visually parse, and should therefore be rejected by language authors, even if they believe they have sound compiler or type theory rationales. Programming languages exist primarily for developers, not to aid the compiler or underlying theories. "Write once, Read many" must be the first law of language design! I am thus hugely disappointed that Kotlin, which has many fine features taken from Fantom, did not think through this choice in more detail, and I plead with the authors to change their minds before Kotlin is locked down. Opinions welcome, and I'm sure there will be lots... ( Jul 24 2011, 11:49:03 PM BST ) Permalink Comments [43]Kotlin and the search for a better Java Another day, another new JVM language. This time Kotlin. My first point here is that another group is willing to go public and say that Scala is too complex. It is easy to miss this, but anyone writing a new language right now (Kotlin, Ceylon, Gosu, Fantom, ...) is implicitly saying Scala isn't right. Of course I don't expect Scala supporters to like this or agree with it, but the truth is that I and many others have looked at it and run fast in the opposite direction. As I've commented before, my dislike for Scala is not support for Java. There is a lot wrong with Java, and that cannot be sorted out without breaking backwards compatibility. Elements like primitives, arrays, wildcard generics and basic operators like equals. That is why I have proposed a backwards incompatible Java - #bijava. More generally, my position is that as a community there is a role for a popular, statically typed, industrial, Java-like langauge without Java's warts. The Java-like also means a design that manages complexity and is usable by the mass-market. Fantom, Gosu, Ceylon and Kotlin are targetting that market. Groovy, Clojure, Scala and many others are simply not targetting that specific market. I can't comment that much on Ceylon as it is more vapour than reality and from the little public information appears to have some dubious design decisions, especially around verbose words rather than syntax. I've also not studied Gosu much for some reason, yet in a day I've looked at Kotlin a lot (not sure why Gosu doesn't excite me...). Fantom is probably the most different of the four. It provides a new platform, which happens to run on the JVM (and in the browser via Javascript!). The core Fantom library is new and dedicated to Fantom, with some different design principles to those of Java. It also runs its own form of bytecode, allowing deep immutability, non-null types, full modules and reified generics amongst other things. In fact, one could question whether Fantom fits into the group of four at all, however it does fit the criteria of statically typed, industrial and Java-like. So, what about Kotlin? Well at first glance it gets a lot right, starting with null-safety and type inference. However, I have real issues with some features, which I think a proper Kotlin blog piece should focus on. More generally if I could wave my magic wand, I would probably wish that Ceylon and Kotlin would merge into a single project. (Gosu and Fantom are now used in production, and Fantom has many different goals, so both are harder to change now.) Basically, we need the energy of all that input (and associated money) but with a better, single focus. Both Ceylon and Kotlin are still mostly paper languages, and both are trying to achieve the same thing (with Kotlin looking closer than Ceylon at this point). RedHat and JetBrains could you please have a conversation? (I'm happy to mediate if desired.) SummaryI still like Fantom and I think most people hugely underestimate it, especially those from a Scala background. Fantom's rethinks what a language should be from the platform/productivity perspective with deep immutability, deep modules, no shared state and a practical type system that aims to eliminate bugs not be in absolute control. Scala is in many ways, light years behind Fantom. And this is my key point with Kotlin too. Simply focussing on syntax is worthy, but kind of misses the point. Syntax exists simply to express the programmers intent in a way that should be readable years later. What makes a bigger difference are the productivity issues that are not typically thought of when talking about a language - versioning of code, which logging library to use, how to access configuration or injected state. Kotlin tackles the syntax parts pretty well, though not perfectly. But its not clear yet if they can grasp just how unimportant the syntax is relative to language related productivity gains. ( Jul 21 2011, 09:07:12 AM BST ) Permalink Comments [27]JCP - Bonn meeting October 2010 In writing my last blog entry I realised that I never wrote up details of the Executive Committee meeting in October 2010. Thus, this post is is mostly for the historical record, but it could be a useful pointer for the Google/Oracle lawsuit. Why is this still relevant?The Apache Harmony case can seem like an odd one to write about today. After all aren't we all happy that Oracle is investing in Java and Java SE 7 will be released soon? But in achieving this there has been collateral damage that cannot be resolved until the Oracle Gooogle lawsuit is resolved. Apache only joined the JCP once it had established the right for any JSR to be implementable by Open Source in general, and Apache in particular. When Sun signed up to the JSPA legal agreement, they knew they were signing up to something that would allow another implementation of the Java SE specification. When Apache Harmony began, Sun said nothing about restrictions that would prevent it completing. Only when Apache asked for the testing kit did Sun say something (or as I would say, change the rules). The timeline is important. Legally important. In May 2005 we have this:
Part of the reason these Apache projects are possible is that the JCP has been working over the last
few years to clarify the role of open source projects and also to improve overall transparency.
For example there were changes to the intellectual property rules in JCP 2.5 specifically designed
to allow open source implementations. There have also been a number of transparency improvements in JCP 2.6
to allow earlier access to specification information. In addition to those JCP updates, Sun created a
scholarship program under which we have provided Apache (and other not-for-profit groups) with free
access and free support for Sun's Java compatibility test suites.
And lets look at how that was reiterated in the business terms for Java SE 6:
JSR 270: JavaTM SE 6 Release Contents
These two passages create a clear intent that Sun would not do anything to block Apache Harmony as an open source project under the Apache license. With the JSPA legal agreemnet and these additional statements, Apache acted, only to later be blocked. I said "Legally important", because there is probably an element of estoppel here (but IANAL!). Basically estoppel prevents a party (Sun) from promising one thing, causing another party (Apache) to act on the promise, and then changing its (Sun's) mind to its own advantage. Its still legally important today because a key plank of Google's defense against Oracle is that Apache Harmony would be a valid implementation of Java. To balance this, I must point out that Google wasn't directly involved in the Apache-Oracle battle (its a third party), so estoppel would only apply if Google could justify it acted based on the same promises (remeber IANAL!). 5th/6th October 2010 face to face JCP Executive Committee meetingSo, back to the JCP EC meeting. This meeting was the key event where Oracle announced its final decision on Apache Harmony. This was before Doug Lea, Tim Peierls and the Apache Software Foundation left the JCP, and before IBM moved from Harmony to OpenJDK. The JCP had been debating the issue since 2007 (with private efforts to resolve the situation being made by Apache and Sun before it came to the JCP and before it became public). Oracle had originally (with everyone else) sided with Apache. Until Oracle took over Sun. The first part of the meeting minutes show a vote:
Prior to this meeting Doug Lea proposed and Tim Peierls seconded the following motion: Clearly, most EC members viewed the correct solution to be an independent JCP. We also note two of the "quieter" JCP members avoiding voting Yes (HP and Fujitsu).
Patrick reported that Steven Chin replaces Wayne Carr as Intel's primary rep Wayne Carr was a strong supporter of Apache. He was replaced at the key moment in the debate, right before the key (first) vote on Java SE 7. I'll leave readers to speculate on why that change was made.
Don Deutsch reported that Oracle has spent several months in consultation with EC members, with developers, and with Java customers
trying to work out a way forward. They have looked at a wide range of options and discussed various working arrangements, and finally
concluded that Apache Harmony sets the stage for an inevitable fork. Even if Apache Harmony itself strictly complied with the TCK there
is no ability to enforce compliance downstream (Apache cannot guarantee that either Apache communities or downstream users will strictly
comply with compatibility requirements.) Consequently, Oracle has concluded that they cannot grant Apache a TCK license. Don stated that
this decision is final - it will never change. He said that Oracle doesn't believe that the Java community fully understands the risks
and consequences of a fork, noting that the Google Android situation is analogous to that which caused Sun to take legal action
against Microsoft several years ago. This is the key paragraph. The argument is couched in terms of a fork and references Android directly. No mention is given of Java EE where competing implementations are deemed positive, not negative. More specifically, Oracle state that their decision is final. Personally, I disagree with the notion that the Android case is analagous to the Microsoft case.
Don acknowledged that the community is frustrated by the lack of technical progress caused by this licensing dispute and said that Oracle
plans to move forward with delivering new Java technologies through OpenJDK. Developer reaction to the plans announced at JavaOne was very
positive. He said that Oracle will submit umbrella JSRs for Java SE 7 and Java SE 8 shortly after this meeting and that Mark Reinhold will
present details of their contents later today. The JSRs will be presented with similar license terms as previous umbrella JSRs. The second of these paragraphs indicates that there was a clear statement that Oracle would proceed with Java SE 7 with or without the blessing of the JCP. (Apparantly it was stated more clearly in person) As stated, the JSRs for 7 and 8 were released a few days later, and contained the same restrictions. The last paragraph is interesting when you look at timing again. The paragraph provides a welcome to other partners to join OpenJDK. An offer made on the 5th October. One week later on the 11th October, IBM abandoned Harmony and joined OpenJDK. Would the Oracle and IBM reps at that table have known about that upcoming deal?
Jason Gartner said that IBM was disappointed with this decision - it wasn't what they wanted. He expressed the hope that if he was
in Don's position he would be giving a different message, but of course he was not. He argued that Oracle is not Sun, and will not
change their minds. The important question was what to do next. He pointed out that the JCP had been in stalemate since 2007, and
it was necessary to be constructive and to move forward. He said that he was looking forward to hearing about the plans for Java SE 7 and SE 8. Would IBM therefore have been a better steward of Java? IBM believe so, perhaps unsuprisingly. But this also suggests that IBM is looking forward, beyond the dispute.
Scott Jameson said that the topic under discussion was licensing and Field of Use (FOU). He noted that FOU restrictions were the
root cause of the dispute, and asked Don to comment on whether or not FOU restrictions violate the JSPA. Don responded that Oracle
intended to continue to offer licenses on the existing terms. In the first highlighted part, Doug Lea links Java SE 7 to the dispute, confirming my original blog in 2009. In the rest of this passage, Oracle effectively blocks questions about why they changed their mind on the JSPA. In the second and third highlighted parts, Josh Bloch pushes the point - Oracle agreed that Sun's action was in violation of the JSPA, yet now they were doing the same. The point was batted away. Personally I believe that Sun's reason for denying Apache Harmony was to protect Java ME licensing revenue (Sun was broke), while Oracle's reason was the Google lawsuit (which is clearly higher priority than a vibrant Java community). Corporately, Oracle must feel very strongly about attacking Google, because they were willing to change their minds on this issue in a way that looks incredibly stupid, especially with no attempt to justify it (because its at the heart of the lawsuit against Google...). EC members also called for the JSPA to be changed as they could not condone breaking it. This proposal to change the JSPA is essentially from a similar vein as my Split JCP proposal. Doing so would have greatly lessened the damage to the JCP, but Oracle chose not to do so (perhaps because doing so would be a tacit admission of fault in a document key to the Google lawsuit).
Mike DeNicola addressed the question of why the EC was focusing on licensing given its supposed charter. He noted that
the JSPA requires the submission of a JSR and that the ECs were the Expert Group for the JSR that defined the JSPA.
They wrote the rules (he was involved.) This is how they got involved in licensing. When the FOU issue was first raised
EC members said "when we wrote the current version of the JSPA we intended to move towards standardized open licenses.
We removed restrictions from the spec license, but we overlooked the TCK license." Sun lawyers had argued that the JSPA
didn't restrict what could be written in TCK licenses but EC members disagreed. Oracle's lawyers now seem to have reached
the same conclusion as Sun did. He argued that it was necessary to move forward and that this discussion was not constructive.
Lawyers should review the JSPA and if necessary they should suggest changes to clarify its intent. In this later passage, we have some history on how the mess happened. It is suggested that the testing kit was an oversight and that the lawyers of EC members and Sun (now Oracle) disagreed over whether the JSPA did or did not allow testing kit restrictions. But if you look at the statements at the top of this blog, you'll get a different set of opinions, suggesting Sun's legal opinion was a later thought to wiggle out of a contract they no longer liked.
Josh read the resolution recently proposed by Doug Lea (as recorded at the beginning of these minutes.). He noted that it was
passed without objection, but without a vote from Oracle. He had asked why Oracle didn't vote. Don Deutsch asked why Josh was
raising this again. Josh responded because he still hoped to see an independent organization. Don responded that he had originally
proposed this motion back in 2007, and expressed his surprise that Josh cast Google's vote in favor of the motion since the wording
included a statement about the importance of compatibility, which Google did not seem to care about. He pointed out that nobody had
offered to pay for the Java assets, nor for the very significant ongoing expenses of developing the Java platforms. Oracle did not
vote on the resolution because it was orthogonal to the issues the EC was addressing. Later in the discussion Josh responded that
Google does care about compatibility - when they build something that they claim is standards-compliant they work hard to make it so. In this later revealing section, Google and Oracle clash. Oracle says "Google doesn't care about compatability". Google says "we do when we claim it is compatible" (ie. we didn't claim Android is compatible).
Don's comments about Java assets prompted a discussion about the difficulty of forming an independent organization without control
of the Java brand and without ownership of the core assets of the Java platform. (Josh Bloch and Geir Magnusson argued that it would
not be necessary for an independent organization to own the Java assets.) Jason Gartner pointed out that Oracle owns the Java brand
and will not give it up. EC members could still work to influence Oracle. There was general agreement (if not approval) of this situation. And here is the final part of that section. An independent JCP is meaningless without the Java brand, but Oracle will not give it up. The final sentence rather suggests the EC members were beginning to give up, which they formally did when they passed the Java SE 7 JSR into being at the expense of Doug Lea, Tim Peiels and Apache leaving the JCP. SummaryAs I said, I'm no longer here to change minds. But as this blog effectively acts as a record of the dispute it only seems right to documnet a missing piece. (I didn't write about this at the time because these meeting minutes were, unsurprisingly, delayed in publication). And I have pointed out, this dispute is clearly referenced by Google as part of their defence against Oracle.
Java SE 7 passes in the zombie JCP So in the end, there is a "Java SE 7". The vote at the JCP Executive Committee passed. But since I first started following this story back in 2009 its been a long road with a huge political fallout. The Yes vote today happened because Oracle made a decision to kill Apache Harmony. A decision that was a continuation of Sun's policy, but one that Sun was not strong enough to make happen. Oracle's decision was to tell the JCP that it would proceed with version 7 no matter what the Executive Committe voted. The cost of this decision was that Doug Lea, Apache and Tim Peierls left the Executive Committe. As such, I view the JCP as a zombie and under no circustances an Open Standards body, as promised in 1996. You cannot claim to be an Open Standards body if you do not allow implementations of the specification. So, this vote today is realy the end of a very long story - see below for the full history of blogs. As always in the JCP votes, the Yes/No vote is only half the story. The comments tell you the rest:
On 2011-05-31 VMWare voted Yes with no comment. Considering this is a major release of Java, a platform used by more than 8 million developers, those comments are not a ringing endorsement. Specifically, the comments note that Oracle's promises to have open and transparant JSRs have not been fulfilled. More broken promise then. Why am I not surprised. As I said, there used to be a Deal. Where the owner of Java makes a large investment and the community makes it relevant. By constantly thumbing its nose at the Java community, Oracle is harming its own interests. But I don't think they care anymore. And yet, it could still be fixed - <tounge-in-cheek>Apache OpenJDK anyone</tounge-in-cheek>?
Stephen Colebourne
This is the history of my blogs on the topic. I've starred my favourite entries: A few words on beans and properties in Java, prompted by the JavaFX 2.0 API and my work on Joda-Beans. Beans and PropertiesI was prompted to write this by the new API of JavaFX 2.0. It has a new extension to JavaBeans that adds support for properties, so that the JavaFX GUI can bind one property to another. I've been writing property extensions to JavaBeans for over 12 years now, so I feel I should comment on the design. The basic design approach is to have an object representing each property on a bean. This object allows meta-data attributes to be stored per property (useful for marking errors), property change listeners (for GUIs) and tool access without reflection (allowing XML input/output, XPath, JSON etc).
The basic design adds an additional method to the JavaBean pattern.
Alongside
// basic querying via JavaBeans or property
String surname = person.getSurname();
String surname = person.surname().get();
// additional features available with properties
Property<String> property1 = person.surname();
Property<String> property2 = person.property("surname");
Map<String, Property<?>> propertyMap = person.propertyMap();
person.surname().setAttribute("error", "MANDATORY");
person.surname().addListener(...);
All the versions of this I've written follow a pattern relatively similar to that above. And the JavaFX 2.0 design is remarkably similar to this. However, some implementations of the pattern are more successful than others. Version 1 - Original JodaMy initial work in the area was private, but I wrote a variation in open source around 2000 (unmaintained from 2002). This was the first Joda project (before Joda-Time), and still lives on the web here (Javadoc). Here is the original Joda approach (shown with generics for clarity):
public interface Person {
Property<String> surname();
String getSurname();
void setSurname(String surname);
}
In that project, the class was created using a Version 2 - Instantiated Property objects
This version existed at one of my old day jobs.
It used code generation rather than
public class Person extends Bean {
private final Property<String> surname = new Property(String.class); // object created when person created
public Property<String> surname() { return surname; }
public String getSurname() { return (Strung) surname.get(); } // state held on the property
public void setSurname(String surname) { surname.set(surname); }
}
Note that every time a Version 3 - Data on the bean
The version 2 approach stored all the state on the
public class Bean {
private final Map<String, String> attributes;
}
public class Person extends Bean {
private final String surname;
// code generated:
public Property surname() { return new Property<String>(this, "surname"); }
public String getSurname() { return surname; }
public void setSurname(String surname) { this.surname = surname; }
protected Object propertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case 36527358: return getSurname(); // number is "surname".hashCode()
}
return null;
}
}
This approach moves all the state from the property back to the bean itself. The superclass would store any common items, like the attribute map (for error code) or the listeners, while the main person class stores the data using normal fields. The code generation adds a method that connects up the field without reflection. Since the property is esentially stateless, it can be created on demand, used and then discarded. Short lived objects like that are good for the garbage collector, so long as they are not used too frequently. This design was successful on the server side, and supported all the other goodies, like conversion to and from XML and XPath searching, all without reflection. I believe that a dynamic code generation approach would also work, but the static code generation was effective enough that we didn't go further. Version 4 - Joda-Beans (the next generation...)The new Joda-Beans project (Javadoc) is an open source version of the version 3 approach, written from the ground up, but focussed on the essential elements for simplicity. It is currently in use at OpenGamma.
Again, a code generator is used to create the getters, setters and property methods, plus the supporting
methods like Rather than show a code sample here, I encourage you to look at some example classes to see what the code generator produces: Person, Address and the subclass CompanyAddress. The developer only writes the part outside the "code generated" block. The block is generated and re-generated without destroying any additional methods that are hand-written, so you can treat it as a "normal" class in all other ways. Once again, the property objects hold no long-lived state and are created on demand. After 12 years of working with properties, I'm convinced that is the only design that scales acceptably for the server side on the JVM. While the Joda-Beans project is not at v1.0 yet, it does work and enhances coding in Java. I'd love to have some early adopters try it out! JavaFX 2.0The JavaFX 2.0 approach uses stateful properties (Javadoc - javafx.beans packages). As I've discussed above, such an approach is powerful and conceptually simple, but has performance issues on anything other than the client side. Some articles on the JavaFX 2.0 approach are here and here Clearly, a major concern of the design is listeners, but I still have concerns about this approach. Other implementationsThere are other projects too that have tackled this problem, including Proper properties, Bean-properties, Better beans binding, and Remi's compiler changes (I'll add anything in the comments to this list). No project has won a large mind share though, and most seem unmaintained. A related solution is the ugly JPA typesafe extension. Language solutionsI've said this before and I'll say it again. The lack of properties in Java is the biggest missing langauge feature and the amount of wasted development time globally by developers writing beans or tools to access properties is gigantic. Moreover, I believe that adding properties to Java is more important than both generics and closures, and should have been prioritised accordingly. (Every enterprise developer knows how much they use the broken JavaBean approach.) The new JVM languages all have properties (no surprise there), although not all have proper support for obtaining an object to represent the property. Maybe one day, Java itself will support properties as a language feature, it is being vaguely mentioned now, but I'm not holding my breath. SummaryProperties are a hugely beneficial language feature and raise the abstraction level of coding. While the Java language continues to not have them, you can use or help the Joda-Beans project to add them to your codebase. My experience suggests that the JVM is poor at handling stateful property objects. Unfortunately, this is the route that JavaFX 2.0 has chosen. It might work for them (because they are client side, and because JVMs are getting faster), but I would advise against using JavaFX 2.0 properties on the server side without lots of performance testing. Feedback welcome... ( May 29 2011, 01:00:02 PM BST ) Permalink Comments [18]So, if the Java Community Process is now a zombie Java Corporate Partnership, what should I do with JSR-310? JSR-310I've been highly critical of Oracle's stewardship of Java, particularly on the topic of the JCP. Choosing to U-turn on their previous public statements and force through the Java SE 7 and 8 JSRs was bad for Java and bad for Oracle. By accepting Oracle's actions, the remaining JCP executive committee members ended the notion of the JCP as an open standards body. So, the question arises as to whether I should cut my ties with the JCP and terminate JSR-310. The reasons to abandon the JSR are quite compelling:
However, I must also ask what the result would be if I stopped the JSR:
Ever been between a rock and a hard place? The upside is that the process of the JCP provides all the power to the specification lead. So, since I, and Michael Nascimento, are the specification leads for JSR-310, we have all the power :-) Consider what I said when the JCP asked me about transparency: Anyone can access these javadoc files by just clicking a link on the JSR 310 website at java.net. Stephen says, "We always intended to run the JSR as an open source project. That naturally means public code, and feedback. Collecting the feedback is easier if people can access it by the method they are most familiar with -- javadoc." Some Spec Leads may be reluctant to run their projects as openly as this, but Stephen has no qualms at all. He says, "It's often thought that being open will increase the mails and issues you have to deal with. The reality is that you tend to have to address the real issues earlier than you might otherwise have to, and that is a very good thing." The key phrase is "run the JSR as an open source project". Because if the JSR is an open source project then the status of the JCP is more of a detail, an annoyance. So, while my heart might tell me to walk away from the zombie JCP, my head tells me that I really don't need to. This is just an open source project which the community badly needs. And the JCP is just a tool I can use to access Java SE 8. I dislike maven as a tool, yet I still use it - I can dislike the JCP and still use it in exactly the same way. Therefore, I've decided to continue work on JSR-310, targetting Java SE 8. I've also taken advantage of the impending destruction of the original java.net website to move the code and discussion to sourceforge, where I hold most of my other projects. I've also chosen to give the reference implementation a real name - ThreeTen. So, the ThreeTen project is the reference implementation of JSR-310. Development of both the reference implementation and the JSR will occur at the ThreeTen project. As part of this process I've attempted to clarify the legal position of contributions to the project, including discussion, without getting too legal. The concept is that the overriding principle is that the project works on trust and respect for the public good. Beyond that, version controlled contributions continue to use the BSD 3-clause license, and version controlled contributions destined for JSR-310 continue to require a contributor agreement. As such, existing mailing list subscribers need to resubscribe to the new mailing list. I also leave open the option of writing a ThreeTen specification separate to the JSR-310 specification. The aim of a ThreeTen specification would be to provide common terminology and behaviour at a higher level with the intention of sharing the knowledge gained to other areas of computing. This might be another language, library or specification, such as SQL or XML. Finally, I'm pleased to confirm that I will continue to spend 20% of my work hours on ThreeTen/JSR-310 thanks to my employer OpenGamma where the project is a core part of their platform for financial analytics and risk management.
Stephen Colebourne This is the story of a deal. Not one that was ever signed on a piece of paper. But one that was still very important. Its the deal between the owner of Java and the Community. The DealThis is my view about how the owner of Java and the Community have interacted:
The owner of Java makes a large investment.
By "owner of Java", I mean Sun, then Oracle. The key point is that this is a symbiotic relationship. The investment by the owner is worth much, much less if the language is not relevant. And the community needs an actively developed core and common set of rules to build upon. When you consider the limited nature of the core of Java, this should be self evident. The core consists of the JVM, compiler, language and core libraries. Enough to get everyone started, but not that interesting in and of itself. What is interesting about "Java" is everything else: Servlets, JMS, Tomcat, JBoss, Lucene, JMX, Eclipse, Ant, Portlets, Lombok, Devoxx, Javalobby, Axis, JIRA, RESTEasy, Terracotta, Ivy, JSP, TestNG, Grails, Mule, Android, ICU4J, MyFaces, Scala, James, Geronimo, JCS, OFBiz, Jetty, GWT, Websphere, JFreeChart, JavaMail, FastUtil, Xerces, JDBC, Griffon, JProbe, SLF4J, Wicket, XOM, JavaOne, Seam, Emma, HttpClient, EHCache, TheServerSide, Roo, Mockito, HSQL, Guice, FOP, Kindle, Velocity, Clojure, JNDI, Clover, Hadoop, JSF, Jackrabbit, Livescribe pen, Commons, Hibernate, EJB, Tobago, IntelliJ, Jersey, Scalaz, HornetQ, JAX-RS, Lift, Derby, JUnit, Freemarker, JavaME, Mylyn, Gaelyk, MINA, Play, JBPM, Cobertura, Antlr, Artima, Findbugs, Hessian, OGNL, Quartz, Trove, Tales, Javolution, Weblogic, Spring, Maven, QCon, Guava, JPA, Colt, Zing, Pico, JAXB, Applets, Struts, Groovy, JavaFX, Log4J, BluRay, Glassfish, Tapestry, JavaRanch, JRoller, Fusion, Excelsior JET, JAX-WS, BIRT, JDOM, Yourkit, SmartCard, JTA, Fantom, Gradle, Netbeans, OSGi, CXF, JSTL, ActiveMQ, JEDI, Camel, JRuby, ServiceMix, Jython, Joda-Time, and many, many more! It is a huge ecosystem - with a gigantic community The investment by Sun, now Oracle, is miniscule compared to that of the rest of the community. Essential and vital, but miniscule. And that is The Deal! The investment by Sun/Oracle (which is increasing under Oracle) is a whole lot less valuable if the community and ecosystem is destroyed. And that is why the recent Java Community Process debates really matter. In order to function, there needs to be a safe base for everyone to work off. This has for many years been investment from Sun/Oracle moderated via the Java Community Process. But that deal has hit a major roadblock in the last few months. The crazy part is that by damaging the community, Oracle's actions damage themselves! As The Deal indicates, Oracle's current increased investment, and the pushing forward of Java 7 and 8, is of limited value if the community and ecosystem ebbs away and ceases to make the platform relevant. The lawsuits and JCP actions simply serve to push that community away, creating distrust. Some in the Oracle management chain need to think again about what community and ecosystem really means. Sometimes it means taking decisions that are against the immediate and obvious business benefit in order to keep the community and ecosystem happy and productive, gaining a bigger business benefit later. The message is simple. Everyone in the community and ecosystem, from the biggest company to the smallest individual matters. Even those who might be classified as "enemies" or "competition" are in fact business partners who are vital to Oracle's investment in Java. That's what a symbiotic relationship means. And what The Deal summarises.
Stephen Colebourne Today, the Apache Software Foundation (ASF) joined Doug Lea and Tim Peierls in resigning from the Java Community Process (JCP) Executive Committee (EC). The message from the ASF was simple - The JCP is Dead. But is it? Is the JCP dead?The JCP, is the Java Community Process, setup in 1998. But why did it get created at all? Well, back in 1996 - 14 years ago - Sun started on the road of creating an globally recognised Open Standard for Java at the International Standards Organisation (ISO). This standard was a promise to the community, in part to gain adoption of the platform. If you weren't involved in Java at the time this might seem unimportant. Yet I can remember using the promise of an Open Standard as one of the arguments for adopting Java as the principal language in the insurer I worked at. I'm sure other developer's similarly found the Open Standard argument useful in adoption discussions. That promise was responsible in part for the rapid adoption of Java. Sadly, the tale of standardisation through ISO, and then ECMA, is a sordid one. This was a time when Microsoft feared and abused Java resulting in a lawsuit. Sun faced two main hurdles. Firstly, that it wouldn't give up its copyright, patents, trademarks or rights to the compatibility testing suite (which ISO wanted them to). And secondly, the very rational fear that its competitors, notably Microsoft and HP, would abuse the standards process to gain control of, and destroy, Java. (For full details, see this excellent academic paper). The JCP was setup effectively after the efforts at ISO and before the efforts at ECMA. But initially, it was very focussed on vendors, with a minimum $2000 price tag per year. Some early criticism is still interesting:
To me this makes it pretty clear, that this process is not an open one. If you're still not convinced, ask yourself these questions: In hindsight, Sun's choices to avoid ISO and ECMA look reasonable. Java was not that established, and fast moving technology often doesn't fit well in standards bodies. And the threat from Microsoft was very real. Thus the JCP was better than nothing. It wasn't an open standards body though. The Apache Software Foundation (ASF) did not participate initially but later played a part. In the lead up to JavaOne 2002, the Apache Software Foundation worked with Sun to ensure that specifications from the JCP could be implemented in Open Source. On stage announcement (large mp4 file) and Press reports:
The biggest news of this year's JavaOne was delivered Tuesday morning by Jason Hunter, an Apache Software
Foundation vice president, co-creator of JDOM, and author of the popular O'Reilly Servlets book. Flanked by
Sun CEO Scott McNeally and Sun vice president Rob Gingell, Hunter outlined an agreement negotiated between Sun
and Apache that has broad-ranging implications to developers and to the future of Java itself. First, all
in-progress and future Sun-led Java Specification Requests (JSRs) will be made available under a license that
allows for open source. This agreement from 2002, and the associated updated JSPA legal agreement, are the defining legal basis for the ASF's actions today. The actual JSPA says. Other than as set forth above, the Spec Lead agrees not to impose any contractual condition or covenant that would limit or restrict the right of any licensee to create or distribute such Independent Implementations. Since 2002, the ASF, and many others, have implemented JSRs using these rights. This includes Apache Tomcat, Geronimo, OpenEJB, MyFaces and many more. The ecosystem worked! And surely the community now had an Open Standards body for Java equivalent to ISO? But, when the ASF started the Harmony project, Sun was not happy. It decided to stop Harmony using a Field Of Use restriction on the testing compatibility kit. The aim was simple, if Harmony passed the tests, then it wouldn't be open source software. Thus the ASF couldn't release Harmony. It was legally clever. Except that it conflicted with the JSPA legal agreement, as outlined above. After private negotiations went nowhere, the ASF talked to the JCP Executive Committee (EC). The EC supported the position of the ASF in two critical votes. Oracle voted in support of the position of the ASF in both votes. By this stage, Sun was in financial trouble. The apparent threat from Harmony was that the Java ME licensing revenue would disappear, and since every last dollar mattered, Sun did not feel able to concede. Instead, Sun released OpenJDK as the GPLv2 implementation of Java, placating some like Richard Stallman. But the dispute itself dragged on. And on. And on. Until Oracle bought Sun. At that point there was hope that the issue would be resolved. After all, Oracle's public position was in support of the ASF. But over time it became apparent that Oracle intended to make no change to the licensing offered. It had done a U-turn. So why didn't the ASF sue Sun, then Oracle? Well, basically its a really bad idea for a not-for-profit to sue a mega corporation, no matter how good the case. (That said, it might still have been the better course of action) And why did the Executive Committee fail to fix the problem? Because there is no dispute resolution process in the JCP. All legal agreements are between the member and Sun, now Oracle - because the JCP itself is just a department, not an actual legally recognised organisation. What the EC could do was prevent the approval of the Java SE 7 JSR. And they did. While this isn't the whole reason why its been so long since Java SE 6, it is a major part of the story. Once Oracle finally got to grips with the issue it made a decision to force Java SE 7 and 8 through, no matter what. Tim Peirels captured this in his resignation statement: Add to that Oracle's expressed intent to proceed with the SE7/8 JSRs whatever the outcome of the vote, and one can only conclude that the SE/EE EC is never going to be more than a rubber stamp for Oracle. (The belligerent tone with which this message was delivered does not come across in the public minutes, but it was loud and clear over my phone connection.) At the same time, the second strand of Oracle's plan was in action. IBM and Apple were being invited to join OpenJDK in leadership positions. Effectively, this was the sign that IBM would now vote through the Java SE 7 and 8 JSRs, irrespective of the ASF dispute. However, even I was surprised at just how clear the mismatch between the Java SE 7 license and the JSPA was. Not only that, the license terms are inconsistent with the stated uses of the JSR itself. Of course, none of this mattered. The EC corporate members, and their lackie Eclipse, had decided to pass the JSRs even though they were in violation of the legal agreements. This was now big company politics, and if the ASF had to go, then it had to go. Doug Lea resigned just before the vote. Tim Peirels just after. And today, the ASF joined them. After all, there is no point helping to write specifications that you aren't allowed to implement. But were they right to declare the JCP is dead? The first ASF claim is that the JCP is not an open standards organisation because there are restrictions made in the commercial interests of one party that prevent another from producing an implementation. The second ASF claim is that the EC failed to perform its duty to enforce the rules and to defend a fellow member.
By approving Java SE 7, the EC has failed on both counts : the members of the EC refused to stand up for
the rights of implementers, and by accepting Oracle's TCK license terms for Java SE 7, they let
the integrity of the JCP's licensing structure be broken. But none of this definitively means that the JCP is dead. Oracle's public argument is that Java needs to move forward: Last month Oracle renominated Apache to the Java Executive Committee because we valued their active participation and perspective on Java. Earlier this week, by an overwhelming majority, the Java Executive Committee voted to move Java forward by formally initiating work on both Java SE 7 and SE 8 based on their technical merits. Apache voted against initiating technical committee work on both SE 7 and SE 8, effectively voting against moving Java forward. Now, despite supporting the technical direction, Apache have announced that they are quitting the Executive Committee. Oracle has a responsibility to move Java forward and to maintain the uniformity of the Java standard for the millions of Java developers and the majority of Executive Committee members agree. We encourage Apache to reconsider its position and remain a part of the process to move Java forward. ASF and many open source projects within it are an important part of the overall Java ecosystem. For me, this is very hollow. The reference to "technical merits" covers the fact that many members used their comments to object to the licensing. And frankly, Oracle were going to proceed whether or not the EC voted "Yes". My conclusion is that the EC should have voted "No" and forced Oracle to run Java SE 7 and 8 outside the JCP, thus preserving the integrity of the EC and the JSPA license. And this action would have had zero effect on "moving Java forward". Since the EC voted "Yes", they tacitly accepted Oracle's right to break the JSPA legal agreement when it is in their commercial interest. Given that the ASF has no commercial axe to grind, they made the sensible choice to leave. And since the EC failed to act as the leaders of the industry it is entirely reasonable to say that the JCP is now a sham body where legal agreements mean little. Thus essentially whether you consider the JCP is dead or not depends on what you believe the JCP is. Since 2002, I have essentially seen the JCP as a vendor-neutral open standards body, the Java specific equal of ISO. Clearly, it can no longer be viewed as that. But others have viewed it more as a useful tool for influencing the owner of Java, where the output sometimes allows the creation of a competitive ecosystem around a specification. Viewed this way, the JCP is still entirely feasible. Certainly, Doug Lea saw it as the former: I believe that the JCP is no longer a credible specification and standards body So, is the JCP dead? Well, it will probably limp on for a while. And if the second view of what it is takes hold, then it may have some future as far as big corporates are concerned. But it cannot now be seen as an Open Standards Body. So its both dead and undead. A zombie. SummaryIts the end of an era. An era of hope that the JCP would be Java's ISO, producing truly Open Standards. So as that era closes we look forward to the new closed era of Java. Where its Oracle's way or the highway.
So, the Java SE 7 and 8 votes passed. Java SE 7 passed by 12 votes to 3 (Apache, Google and Tim Peierls voting against). Java SE 8 passed by 12 votes to 3 (Apache, Google and Tim Peierls voting against). Project Coin passed by 13 votes to 1 with 1 abstention (Apache voting against and Tim Peierls abstaining). Project Lambda passed by 13 votes to 1 with 1 abstention (Apache voting against and Tim Peierls abstaining). But it looks like many of the voters were unhappy. Java SE 7 vote resultsWhen voting for a JSR there is the opportunity to leave comments. These often indicate the true feelings of voters more than the actual Yes or No. Here are the actual vote comments for Java SE 7 (the Java SE 8 comments are similar but with reference to OSGi):
On 2010-12-03 Peierls, Tim voted No with the following comment: There is a lot in those comments to understand, and I can't cover it all now. I do note Time Peierls decision (as an individual) to change his vote from "Abstain" to "No" and the reason given. Clearly, Oracle were asked to explain their licensing terms and how they square with the JSPA, and with the JSR text itself, and have failed to do so. My interpretation is that Oracle no longer felt the need to justify its actions. I also castigate Hewlett-Packard, Ericsson AB, Fujitsu, VMWare (SpringSource) and Intel for not even having the courage to justify their actions (which are in direct opposition to previous votes). I will note that Intel has previously been a strong Apache supporter. However, I understand that the Intel representative on the JCP was changed a few months back, prior to the vote (no public source to confirm this as far as I know Update: the executive committee members list has been updated to show the change, which happened since July). I am disappointed in all the "Yes" voters. Clearly Oracle intended to move Java SE 7 forward irrespective of the vote here. Thus voting "No" would have had no adverse consequences on the forward momentum and technical progress of Java. Since the main role of the Executive Committee, distinct from Expert Groups, is to consider the business implications it is clear that each company that voted "Yes" has given tacit approval to the business practices of Oracle. I suspect that they will come to regret that decision. Give a bully an inch and they will take a mile. SummaryToday, Oracle won its battle in the JCP. But it was a stupid battle to have. Submitting a JSR whose licensing terms are in conflict with the JSR itself and with the JSPA was simply unnecessary. Voting "Yes" to it was simply cowardly. The huge irony is that Oracle claims to support Java because all of its money making systems are written in Java, thus it is in its own interests to keep Java vibrant. Yet the strong-arm actions here simply push people away and harm that vibrancy. Go figure. We should expect the response from the Apache Software Foundation soon.
As usual at Devoxx, there were a number of Whiteboard polls. These aim to capture the sense of the community and are of course only semi-scientific! This year, picking questions was a little tricky, given the current disputes. I decided to ask questions focussed on specific topics and provide a choice of responses. Of course, you can never cover all valid responses, so there was always a comment area for extra opinions. The +n notation after a comment means that n other people agreed with the comment. The <- notation means that what follows is a comment on the previous comment. How do you feel about the Oracle vs Google lawsuit?
View the photo. There were also some comments:
A very clear answer was provided on this topic - devoxx attendees that voted were solidly against the lawsuit (over 87%). While a high number thought there might be a case even more thought the lawsuit was just plain dumb. If Oracle wants developers on its side, it is clear that the lawsuit is a problem. As always, the comments were entertaining too. Should Java 8 or 9 be backwards incompatible?
View the photo. There were also some comments:
Clearly, a majority of voters wanted some form of backwards incompatibility (over 87%). This is a remarkably clear result and was more positive than I expected. How do you feel about the JCP?
View the photo. There were also some comments:
Opinion was split here, on a relatively low turnout. Clearly compromise is still valued, but some believe it may be too late. Does Oracle believe in the Java community?
View the photo. There were also some comments:
The message here seems to be that many are still willing to give Oracle a chance. I'm interested in those that do not believe community is important ;-) How should Oracle make money from Java?
View the photo. There were also some comments:
This vote only started on Thursday, hence the lower voting figures. The results ought to be predictable, but clearly a few want $free everything. In general it looks like Oracle's paid vs $free choices are about right. OpenJDK is now the "heart" of Java
View the photo. There were also some comments:
There is definitely support here for other Java SE implementations, yet not a huge number of votes overall. I suspect that amongst those that know the story it matters, but in general it doesn't. I also find the (popular) comment for an explanation interesting. What is your favourite non-Java language?
View the photo. Last year Groovy came top, this year it is Scala. One point to bear in mind is that Groovy conferences are now well established, so possibly those most dedicated to Groovy nonw attend those. Or maybe Scala is getting more popular. And I was personally surprised to see how popular Python is. SummaryDevoxx votes are nothing more than a snapshot of opinion by a proportion of the attendees of Devoxx. Yet despite the caveats, their results can be interesting. Its the power of the community! ( Nov 20 2010, 02:56:15 PM GMT ) Permalink Comments [3]Java SE 7 and 8 JSRs published Following yesterday's statements from Oracle and Apache, the meaty JSRs are now published and announced by Mark Reinhold.
I’m pleased to note the submission of four new Java Specification Requests to the Java Community Process: Cool! Java is moving forward! And JSR-310 is proposed for Java SE 8! But, lets take a peek at the interesting stuff... the licensing terms. (OK, its not really that interesting unless you want to understand the raging Java disputes...) Firstly, the licenses are provided in Word Document format! (See section 2.18 of the JSR page for the links) Its late here, so I only have limited time to evaluate the licenses. At first glance, the Specification and Reference Implementation licenses look fairly normal and bland (but I may be wrong). The interesting one is the TCK (testing kit) license. I emphasise that this should be considered to be notes on the TCK license based on a relatively quick reading. If you read this blog and reference this topic/story in another blog or article, you are advised to read and examine the original license text yourself, or include a suitable caveat. The famous "Field of Use" is an explicit part of the license:
1.4 "Exhibit A" means collectively Exhibits A-1 through A-n which incorporate into the
Agreement the specific terms and conditions for each TCK licensed hereunder. The "Java Environment Specification" is defined, covering Java SE: 1.8 "Java Environment(s) Specification" means a Java Specification that defines a baseline API set that provides a foundation upon which applications and other Java Specifications can be built. For example, and not by way of limitation, Java Environment Specifications include: (a) “Platform Editions” such as the Java Platform, Standard Edition ("Java SE"); Java Platform, Enterprise Edition (“Java EE”); and Java Platform, Micro Edition (“Java ME”) Specifications; (b) “Configurations” such as the Connected Device (“CDC”) and Connected Limited Device (“CLDC”) Configurations; and (c) “Profiles” such as the Mobile Information Device (“MIDP”) Profile. The definition of a "product" contains what looks like an unusual part (highlighted). It appears that a "product" must meet three criteria beyond the basic ones:
I believe that Apache Harmony would fail all three of these tests (were the project to try and implement this JSR, which they probably won't). Since a "stand-alone implementation" would be either OpenJDK or OracleJDK, the principal purpose of Harmony is clearly the same (not substantially different), Harmony does not offer significant functional enhancement, and Harmony would be marketed as a replacement for OpenJDK/OracleJDK.
1.12 "Product(s)" means a Licensee product which: (i) fully implements the Java Specification(s)
identified in Exhibit A including all its required interfaces and functionality; (ii) does not
modify, subset, superset or otherwise extend the Licensor Name Space, or include any public or
protected packages, classes, Java interfaces, fields, methods or constructors within the Licensor
Name Space other than those required/authorized by the Specification or Specifications being
implemented; (iii) passes the TCK (including satisfying the requirements of the applicable TCK
Users Guide) for such Specification; and (iv) neither derives from nor includes any of Oracle’s
source code or binary code materials which implement any portion of the Java Specification, except
for code contributed by Oracle to an open source project (e.g. Apache’s “Tomcat” project)
and that is rightfully (i.e. pursuant to a separate and appropriate license) included in the
product to be tested. In addition, to be a Product, a Licensee product that implements a Java
Environment Specification must: (a) have a principal purpose which is substantially different
from a stand-alone implementation of that specification, while the value-added portion of the
product operates in conjunction with the portion that implements the Java Environment
Specification; (b) represent a significant functional and value enhancement over any stand-alone
implementation of that specification; and (c) not be marketed as a technology which replaces or
substitutes for a stand-alone implementation of that specification. Criteria are given as to what not to do. This indicates that no one may distribute code that implements the specification unless it is part of a product, as defined above. Given Apache Harmony cannot be a product, it cannot be distributed.
(b) Additional Limitations. Except as otherwise set forth in Exhibit A, Licensee may not:
Were a court case to challenge the contents of the license, Oracle can at its discretion terminate the licence. 11.4 Partial Invalidity. If any of the above provisions are held to be in violation of applicable law, void, or unenforceable in any jurisdiction, then such provisions are herewith waived or amended to the extent necessary for the Agreement to be otherwise enforceable in such jurisdiction. However, if in Oracle's opinion deletion or amendment of any provisions of the Agreement by operation of this paragraph unreasonably compromises the rights or increase the liabilities of Oracle or its licensors, Oracle reserves the right to terminate the Agreement. And Exhibit A contains the actual "Field of Use" terms. These specifically exclude wireless mobile telephones, kiosks and even netbooks (highlighted). Remember that any Field of Use restriction violates the OSI open source definition.
EXHIBIT A The published release must contain a note from Oracle emphasising the conditions on further distribution:
1. The following provision is added as subparagraph (viii) to the Additional Limitations set
forth in Section 2.1(b): The cost of the TCK is specified. And it is cheap. So, none of the dispute is directly about money (indirectly is another matter!).
A. For Commercial Licensees: $100,000.00 (as of the Effective Date) per year. All fees shall be due upon execution of this Agreement. In addition, Oracle shall have no obligation to deliver or make available the TCK until such fees are received by Oracle. And thats it. Well, at least the parts I see as being interesting. But if you want to comment on this, you really should read it yourself! Sadly, at 3am, I don't have time to contrast the TCK license with the JSPA. To be honest, I'm surprised that the TCK license for Java SE 7 still contains any pretence that it can be implemented in open source by anyone other than Oracle. At least the restrictions are clear (and I suspect, but cannot prove, that very similar restrictions were offered for Java SE 5 in the Sun/Oracle vs Harmony dispute). I personally expect these 4 JSRs to pass the JCP Executive Committee vote in two weeks time as I see no evidence that committee members are still up for a fight. If the vote passes, I expect the ASF will immediately leave the JCP. I will leave the biggest amusing point until last. The TCK license conflicts with the JSR! The JSR itself says:
2.2 What is the target Java platform? (i.e., desktop, server, personal, embedded, card, etc.) So, the JSR is targetted at embedded environments! That's not what the TCK license says ;-) Stephen Colebourne Apache Software Foundation member, speaking personally Oracle Java Champion, speaking personally Not a committer on Harmony or OpenJDK ( Nov 17 2010, 02:14:00 AM GMT ) Permalink Comments [7] Oracle have responded to the Apache Software Foundation board statement.
Oracle nominated Apache for a seat on the Executive Committee in recognition of Apache's continued
participation and valued contribution to the community.
The recently released statement by the ASF Board with regard to their participation in the JCP
calling for EC members to vote against SE7 is a call for continued delay and stagnation of the
past several years. We would encourage Apache to reconsider their position and work together with
Oracle and the community at large to collectively move Java forward. Oracle provides TCK licenses
under fair, reasonable, and non-discriminatory terms consistent with its obligations under the JSPA.
Oracle believes that with EC approval to initiate the SE7 and SE8 JSRs, the Java community can get on
with the important work of driving forward Java SE and other standards in open, transparent,
consensus-driven expert groups. This is the priority. Now is the time for positive action.
Now is the time to move Java forward.
Update 16 Nov: And the ASF responded to the response!!! Here it is:
Oracle statement regarding Java: "Now is the time for positive action (and) to move Java forward." I've used this blog to highlight the role of politics in the development of Java, especially in this dispute. Personally, I'm glad that this story is coming to an end, as I can write more code and less blogs! Basically, I see this statement from Oracle as expected and well written. Expected, because it simply states the known position. Well written, because it puts a spin on what Apache actually said. The key sentence is "Oracle provides TCK licenses under fair, reasonable, and non-discriminatory terms consistent with its obligations under the JSPA." Bear in mind that the TCK offered would result in the tested Harmony code not being able to be released under any open source license, not just the Apache license. See my previous detailed explanation with pictures. I'm almost amused that anyone would describe those terms as "fair, reasonable, and non-discriminatory". Actually, the sentence doesn't talk about Harmony at all. Technically, it doesn't claim that any fair terms were offered to Harmony. All the sentence actually claims is that Oracle provides TCK licenses under fair terms, which is true for every other JSR expect Java SE. Yes, I really am reading this statement as a lawyer could! I'd also point out Don's previous actions from 2007:
Resolution 1 (proposed by Oracle, seconded by BEA)
Only Don can truly answer why his opinion changed once he was in a position to action what he called for. So what next? Well, barring an earthquake, the Java SE 7 vote will proceed, the vote will go Oracle's way, and the ASF will leave the JCP entirely. I do not see either the ASF or Oracle slowing down the Java SE 7 timetable at this point. Finally, we sometimes need to remember that Oracle continues to invest heavily in Java, from ME to SE to EE to FX. We all want an end to stagnation. I simply object to the approach chosen to end the stagnation.
The Apache Software Foundation board has released a statement regarding the JCP.
The Apache Software Foundation (ASF) is proud to announce that it has been ratified for another three-year term on the Java Community Process (JCP) Executive Committee. Receiving support from 95% of the voters, this election allows the ASF to continue its 10 year effort to help bring transparency and openness to the JCP as well as ensure that Java specifications are able to be independently implemented and distributed under open source licenses. I think there is little to add (I've reproduced verbatim). I do hope that Oracle take one last look at what is about to happen here and offer some form of meaningful compromise. It may be too late, but the impact of this is potentially serious. This new statement appears to superceed the previous statement. For the record, although I am an Apache member, I was not party to the specific decision making in either statement.
The spam filter and numeric calculation check at JRoller are pretty rubbish - sorry about that.
If the numeric calculation check fails, please try again. If your comment is marked as spam, I will retrieve your actual comment for you as soon as I can! View the privacy statement |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||