Bugs item #1155921, was opened at 2005-03-03 16:25
Message generated for change (Comment added) made by achimwestermann
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397078&aid=1155921&group_id=29721
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Other
Group: CVS Head
Status: Open
Resolution: Accepted
Priority: 5
Private: No
Submitted By: kit_ (kit_)
Assigned to: Oleg Sukhodolsky (o_sukhodolsky)
Summary: RequireThis requires adding "this." to static members
Initial Comment:
When is add "RequireThis" checkers to the configuration
file then it requires adding "this." event to static
members.
----------------------------------------------------------------------
Comment By: Achim Westermann (achimwestermann)
Date: 2007-07-21 23:05
Message:
Logged In: YES
user_id=505193
Originator: NO
The reported error message is confusing. I found out that you have to
prefix the class name: Instead of PROPERTY_EVENTNAME use
ClassName.PROPERTY_EVENTNAME even if this code is within Classname. I don't
consider this to be in the scope of "require this" but in general this
seems to be good coding style as you can recognize the location of the
constant which is cool if you inherit them.
kind regards,
Achim (non-checkstyle member)
----------------------------------------------------------------------
Comment By: Oleg Sukhodolsky (o_sukhodolsky)
Date: 2007-01-09 20:20
Message:
Logged In: YES
user_id=746148
Originator: NO
1631665 ("Require This" checker bugs with static fields) was closed as
duplicate of this bug
----------------------------------------------------------------------
Comment By: Lars Kühne (lkuehne)
Date: 2006-12-08 20:59
Message:
Logged In: YES
user_id=401384
Originator: NO
RFE #1610970 (Allow "Require This" to ignore static fields and methods)
has been closed as a duplicate of this bug.
----------------------------------------------------------------------
Comment By: Oleg Sukhodolsky (o_sukhodolsky)
Date: 2006-10-28 23:15
Message:
Logged In: YES
user_id=746148
1490844 (Check RequireThis doesn't filter out static
variables) was closed as duplicate of this bug
----------------------------------------------------------------------
Comment By: Oleg Sukhodolsky (o_sukhodolsky)
Date: 2006-02-26 14:39
Message:
Logged In: YES
user_id=746148
I've re-read 1070794 and it looks like it is better to reopen
this bug.
----------------------------------------------------------------------
Comment By: Oleg Sukhodolsky (o_sukhodolsky)
Date: 2006-02-26 14:36
Message:
Logged In: YES
user_id=746148
Sorry, I missed static methods :(
I will transform 1070794 to bug.
----------------------------------------------------------------------
Comment By: Christoph Kutzinski (kutzi)
Date: 2006-02-26 12:00
Message:
Logged In: YES
user_id=628011
You are right that compiler doesn't complain about
referencing static fields by "this" in instance methods. But
I was talking about static methods. Try this one:
public class RequireThisTest {
static int NUMBER = 1;
static {
System.out.println(NUMBER);
}
}
RequireThis will complain about the missing "this" but with
the "this" the compiler complains because we don't have a
"this" instance in a static context.
So I stand by my accessment that this is a bug and not a RFE.
(Note: to make compiler and RequireThis happy, I could write
System.out.println(RequireThisTest.NUMBER);
But if you see it this way, I would say that in this case
the RequireThis module is wrongly named (and documented) and
should be renamed to RequireExplicitAccess or something like
this)
----------------------------------------------------------------------
Comment By: Oleg Sukhodolsky (o_sukhodolsky)
Date: 2006-02-26 10:16
Message:
Logged In: YES
user_id=746148
compiler does allow to reference static members using "this"
So, compiler will not complain.
----------------------------------------------------------------------
Comment By: Christoph Kutzinski (kutzi)
Date: 2006-02-24 15:44
Message:
Logged In: YES
user_id=628011
Works as designed?
Checkstyle even complains about missing "this." for static
fields in static methods where you don't have an instance of
the class. Means: adding the this to make checkstyle happy
would result in a compile error.
This is clearly a bug and not a RFE.
----------------------------------------------------------------------
Comment By: Oleg Sukhodolsky (o_sukhodolsky)
Date: 2005-03-04 08:45
Message:
Logged In: YES
user_id=746148
the check works as desined, we already have RFE about this
(1070794)
I close this bug as duplicate.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397078&aid=1155921&group_id=29721
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Checkstyle-devel mailing list
Checkstyle-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/checkstyle-devel
|