This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 74345 - cleanup rules
Summary: cleanup rules
Status: RESOLVED FIXED
Alias: None
Product: contrib
Classification: Unclassified
Component: Jackpot (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P4 blocker (vote)
Assignee: issues@contrib
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-04 01:26 UTC by _ alexlamsl
Modified: 2006-04-05 23:36 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ alexlamsl 2006-04-04 01:26:09 UTC
The following looks weird:
{ $p$; $t $v; $intervening$; $q$; $v = $e; return $v; } => { $p$; $q$; return 
$e; }

shouldn't it be:
{ $p$; $t $v; $intervening$; $v = $e; return $v; } => { $p$; $intervening$; 
return $e; } :: !assignedIn($intervening$);

The next one is not wrong, but rather it might be improved - it is the one 
with "Effective Java, item 29: Minimize the scope of local variables":
{ $p$; $t $v; $intervening$; $v = $e; $q$; } => { $p$; $intervening$; $t $v = 
$e; $q$; } :: !assignedIn($v, $intervening$);

which could be more general:
{ $p$; $t $v; $intervening$; $q$; } => { $p$; $intervening$; $t $v; $q$; } :: !
assignedIn($v, $intervening$);
Comment 1 _ tball 2006-04-05 23:36:31 UTC
I lowered the priority because the current transformations are just examples.

You are right about the need for the first rule to have a !assignedIn() guard; I
have updated the rule in the distribution.

I think your second rule would recurse on itself if made too general.  To fully
address all cases for minimizing scope, I think a Java transformation is needed
since Scopes will soon be part of the Tree API and thus can be directly used
instead of inferred.