« December 2009
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today
XML

Blog::Navigation

GetJava Download Button
Get the Source
Personal Blog

Blog::Referers

Today's Page Hits: 1355

Powered by Roller Weblogger.
« My experiments with... | Main | Java SIGQUIT output... »
20060221 Tuesday February 21, 2006

Do these count as pluggable types?

I am reading/thinking about pluggable types. I am interested in this, because I'd like to have customized, project-specific pluggable type systems.

@ReadOnly methods

C++ supports 'const' modifier for methods. These are methods declared with 'const' modifier. Such methods can only be called on variables declared as 'const'. Also, const methods can neither modify instance variables nor call non-const methods. Now, if we add a method annotation @ReadOnly and develop a type checker for that? i.e., an javac plug-in that validates that @ReadOnly methods do not assign to instance variables and do not call other non-@ReadOnly methods. Sometimes, we may want to modify few instance fields in @ReadOnly methods (may be "cache" fields for computed-read-only-state). We may add a field annotation called @Mutable to mirror C++ mutable keyword.

@NonBlock methods

Non blocking methods are methods that

Again a javac apt plug-in may be written to check this at compile time. It is useful to check that certain methods are non-blocking (example: finalize() methods, GUI event handlers).

Now, there is one problem though. With pluggable types, there is going to be multiple type systems -- each possibly requiring the source to be annotated with different annotations. The problem is that most programs use huge third party and/or "platform" API (for eg. JDK API). These APIs will not have the new annotations -- and it is not feasible to annotate pre-existing, possibly "binary only" APIs. I am not sure this problem is due to the examples I've taken -- or that type systems would require "global" changes? With the single type system built into the language, there is one type system used by all programs and so there is no problem there. May be, is it time for me to read more about StrongTalk's type checker?



( Feb 21 2006, 10:14:42 AM IST ) Permalink Comments [1] del.icio.us | furl | simpy | slashdot | technorati | digg

Comments:

Those could be a good candidated for FindBugs detectors and quite easy to implement on a bytecode level. The best part - you don't have to wait two years for new Javac.

Posted by eu on February 21, 2006 at 11:56 AM IST #

Post a Comment:

Comments are closed for this entry.
Copyright (C) 2005, A. Sundararajan's Weblog