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 252116 - Insert Code > Getter creates getter with "const int" return type
Summary: Insert Code > Getter creates getter with "const int" return type
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.1
Hardware: All All
: P4 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-27 14:37 UTC by Vladimir Kvashin
Modified: 2016-10-31 15:54 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 Vladimir Kvashin 2015-04-27 14:37:20 UTC
I added "const int" field into a class. Then invoked "Generate getters". IDE generated getters with "const int" return type.

Although not harmful, "const" is not needed here. It looks a bit funny.

Class before modification:

class PreprocessorDirectiveInfo {
private:
  const int HashOffset;
  const int EodOffset;
public:
  PreprocessorDirectiveInfo(const int HashOffset, const int EodOffset) :
  HashOffset(HashOffset), EodOffset(EodOffset) {
  }  
  // "Insert code" here
};

Geterated getters:

  const int GetEodOffset() const {
    return EodOffset;
  }
  const int GetHashOffset() const {
    return HashOffset;
  }

Frankly, I'm not sure whether this is a P3, as there is no harm in this :)
Comment 1 Vladimir Kvashin 2015-04-27 14:44:09 UTC
compiler issues a warning for such methods:
type qualifiers ignored on function return type [-Wignored-qualifiers]
Comment 2 Alexander Simon 2016-10-31 15:54:13 UTC
(In reply to Vladimir Kvashin from comment #1)
> compiler issues a warning for such methods:
> type qualifiers ignored on function return type [-Wignored-qualifiers]

I do not see compiler warnings.
Please provide additional info about platform and tool collection.