Skip to main content

Mess Around

Posted by editor on September 26, 2006 at 7:53 AM PDT

Why can't constructors do stuff before calling super()?

It's hard for me not to give a strong hint or quick answer in the editor's blog when we do the not-so-stupid questions, because the comments sections always offer some ideas and opinions that aren't immediately obvious, and from these insights come further discussion and brainstorming. And you shouldn't necessarily think that the comments already posted when you read the article are the final word on the subject either; with questions like today's, there are often several ways to think about why things are they way they are, and whether they really have to be.

So enough stalling, what's the question?
Today's Feature Article, features (Not So) Stupid Question #13: "Why do constructors have to start with a call to super()?" Put another way, what if you want to do some work to prepare an argument for your superclass' constructor... why can't you do that first and then call super()? We hope you'll take a look at the initial question and the motivation behind it, and then check in with the ongoing discussion in the comments.


In Java Today,
the Embedded Java Community page is featuring the article Wireless robotics: Object-oriented programming with (physical) objects: "Learn why there is room for the development of new, lightweight wireless networking protocols and how the profusion of wireless computers may represent one way to solve a traditional stumbling block of artificial intelligence."

jSh3ll, the Amazon S3 command shell for Java, is a Java based command shell for managing your Amazon S3 objects, built upon the Amazon S3 REST Java library. In addition to standard Amazon S3Shell functionality, jSh3ll provides ACL and HEAD retrieval for buckets and items, support for getting a .torrent file for an item, script mode support, streaming file upload support, file compression support with ZLIB, and more.

The Enterprise Java Beans (EJB) 3.0 specification vastly improves the simplicity of programming enterprise beans. This promises to increase your productivity as a developer. But what about the productivity of your production system? Will it be fast enough to meet the demands of your organization, or will you spend all your newly found free time refactoring code for performance?
The article Writing Performant EJB Beans in the Java EE 5 Platform (EJB 3.0) Using Annotations shows you how to get the best performance out of the new EJB 3.0 programming model.


Ben Galbraith talks up Ajax and Desktop Conferences in today's Weblogs. "Dion Almaer and I were given the opportunity to deliver a talk on Ajax at JavaOne earlier this year. Many of you told us was that you wished we went into greater depth. I'm happy to say that the Ajax firehouse is wide open: Dion and I are hosting a conference in Boston next month. Also, I'm soliciting some feedback for a Desktop Developer's Conference (again)."

David Herron how the process of public input into planning and prioritizing will work with open-source Java in his blog
Re: Channeling Java SE 7:
"As we move to becoming an open source project, one question we've been tossing around is what mechanism can we follow for bringing in public input to the planning. Of course there is the JCP and mechanisms like votes in the bug parade, but each has their own foibles."

Joshua Marinacci has been working on the Windows look-and-feel for Swing and has a surprising report:
Vista getting better:
"I don't usually blog on non-Java topics here, but I thought I'd make a mention of how Windows Vista is improving. As I've been using it I have to say I'm impressed. I think they are finally doing some things right."


In today's Forums,
jsl123 reports a GlassFish problem in
@Timeout not being called:
"Hi i have an appplication which creates a timer to run every minute. For the last 6 weeks it has run fine, but suddenly over the weekend it stopped. I've added some code to allow me to remotely query the timers to see if they had been cancelled, but again this morning the timer stopped. The relevant code for the bean is as follows..."

Patrick Wright talks about the differences in status bar divider implementations in
Re: JXStatusBar ready for public review:
"I don't know if this is a LAF responsibility or not, but different programs on Windows, at least, follow different standard; some use a separator, but Firefox, for example, seems to be using a lowered bevel border (which was what I proposed in a much earlier revision of status bar). My sense is that one shouldn't have to add separators manually unless one wants "full control"; we could provide a parameter to the constructor as to what type of (automatic) separators one wants, or else just say it's an LAF responsibility."


In today's java.net
News Headlines
:

Registered users can submit news items for the href="http://today.java.net/today/news/">java.net News Page using our
news submission
form
. All submissions go through an editorial review before being
posted to the site. You can also subscribe to the href="http://today.java.net/pub/q/news_rss?x-ver=1.0">java.net News RSS
feed.


Current and upcoming Java
Events
:

Registered users can submit event listings for the href="http://www.java.net/events">java.net Events Page using our href="http://today.java.net/cs/user/create/e">events submission form.
All submissions go through an editorial review before being posted to the
site.


Archives and Subscriptions: This blog is delivered weekdays as
the Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the href="http://today.java.net/today/archive/">java.net Archive.

Why can't constructors do stuff before calling super()?