From 724e1991ac0ec15dd187cc85abf2309c92a0d104 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Wed, 22 May 2013 10:22:38 -0700 Subject: [PATCH] Cosmetics. --- .../checkers/ClassMembersInitializationChecker.java | 9 +++++---- .../checkers/ClassMembersInitializationCheckerTest.java | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ClassMembersInitializationChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ClassMembersInitializationChecker.java index b7d2f619873..8c7b66fa67c 100644 --- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ClassMembersInitializationChecker.java +++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ClassMembersInitializationChecker.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2012 Anton Gorenkov and others + * Copyright (c) 2011, 2013 Anton Gorenkov and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -249,7 +249,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker { } /** Checks that specified declaration is a class constructor - * (it is a class member and its name is equal to class name) + * (it is a class member and its name is equal to the class name) */ private ICPPConstructor getConstructor(IASTDeclaration decl) { if (decl instanceof ICPPASTFunctionDefinition) { @@ -270,10 +270,11 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker { if (memberName != null) { IBinding memberBinding = memberName.resolveBinding(); ICPPClassType classType = null; - if (memberBinding instanceof ICPPClassType) + if (memberBinding instanceof ICPPClassType) { classType = (ICPPClassType) memberBinding; - else if (memberBinding instanceof ICPPConstructor) + } else if (memberBinding instanceof ICPPConstructor) { classType = ((ICPPConstructor) memberBinding).getClassOwner(); + } if (classType != null && classType.isSameType(constructor.getClassOwner())) return null; } diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ClassMembersInitializationCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ClassMembersInitializationCheckerTest.java index 3277f796bf4..be2e57fb593 100644 --- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ClassMembersInitializationCheckerTest.java +++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ClassMembersInitializationCheckerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2012 Anton Gorenkov and others + * Copyright (c) 2011, 2013 Anton Gorenkov and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -606,7 +606,7 @@ public class ClassMembersInitializationCheckerTest extends CheckerTestCase { // struct A { // A(int n) : waldo(n) {} - // A() : A(42) {} // warning: "Member 'waldo' was not initialized in this constructor" + // A() : A(42) {} // int waldo; // }; public void testBug402607_delegatingConstructor() throws Exception { @@ -617,7 +617,7 @@ public class ClassMembersInitializationCheckerTest extends CheckerTestCase { // struct A { // typedef A B; // A(int n) : waldo(n) {} - // A() : B(42) {} // warning: "Member 'waldo' was not initialized in this constructor" + // A() : B(42) {} // int waldo; // }; public void testBug402607_delegatingConstructorTypedef() throws Exception {