File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -745,7 +745,7 @@ void CheckClass::SpaceInfo::getVarList()
745745 }
746746
747747 // If the vartok was set in the if-blocks above, create a entry for this variable..
748- if (vartok && vartok->str () != " operator" && ! Token::Match (vartok-> next (), " ; %varid% = " , vartok-> varId ()) )
748+ if (vartok && vartok->str () != " operator" )
749749 {
750750 if (vartok->varId () == 0 && check->_settings ->debugwarnings )
751751 {
Original file line number Diff line number Diff line change @@ -2244,12 +2244,30 @@ class TestClass : public TestFixture
22442244 ASSERT_EQUALS (" " , errout.str ());
22452245 }
22462246
2247+ void checkUninitVarJava (const char code[])
2248+ {
2249+ // Tokenize..
2250+ Tokenizer tokenizer;
2251+ std::istringstream istr (code);
2252+ tokenizer.tokenize (istr, " test.java" );
2253+ tokenizer.simplifyTokenList ();
2254+
2255+ // Clear the error log
2256+ errout.str (" " );
2257+
2258+ // Check..
2259+ Settings settings;
2260+ settings._checkCodingStyle = true ;
2261+ CheckClass checkClass (&tokenizer, &settings, this );
2262+ checkClass.constructors ();
2263+ }
2264+
22472265 void uninitJava ()
22482266 {
2249- checkUninitVar (" class A {\n "
2250- " private: int i = 0;\n "
2251- " public: A() { }\n "
2252- " };" );
2267+ checkUninitVarJava (" class A {\n "
2268+ " private: int i = 0;\n "
2269+ " public: A() { }\n "
2270+ " };" );
22532271 ASSERT_EQUALS (" " , errout.str ());
22542272 }
22552273
You can’t perform that action at this time.
0 commit comments