From fee20bafa07aa9473d30ac9b6128508ccf4a5327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 28 Oct 2010 18:01:51 +0200 Subject: [PATCH] Java: Removed bailout added in 120073f0001 --- lib/checkclass.cpp | 2 +- test/testclass.cpp | 26 ++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 7a895f44b..7dce4fe67 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -745,7 +745,7 @@ void CheckClass::SpaceInfo::getVarList() } // If the vartok was set in the if-blocks above, create a entry for this variable.. - if (vartok && vartok->str() != "operator" && !Token::Match(vartok->next(), "; %varid% =", vartok->varId())) + if (vartok && vartok->str() != "operator") { if (vartok->varId() == 0 && check->_settings->debugwarnings) { diff --git a/test/testclass.cpp b/test/testclass.cpp index add63abe8..213fa8615 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -2244,12 +2244,30 @@ private: ASSERT_EQUALS("", errout.str()); } + void checkUninitVarJava(const char code[]) + { + // Tokenize.. + Tokenizer tokenizer; + std::istringstream istr(code); + tokenizer.tokenize(istr, "test.java"); + tokenizer.simplifyTokenList(); + + // Clear the error log + errout.str(""); + + // Check.. + Settings settings; + settings._checkCodingStyle = true; + CheckClass checkClass(&tokenizer, &settings, this); + checkClass.constructors(); + } + void uninitJava() { - checkUninitVar("class A {\n" - " private: int i = 0;\n" - " public: A() { }\n" - "};"); + checkUninitVarJava("class A {\n" + " private: int i = 0;\n" + " public: A() { }\n" + "};"); ASSERT_EQUALS("", errout.str()); }