Use instance equality for Class

Closes gh-11534
pull/11527/merge
Johnny Lim 7 years ago committed by Stephane Nicoll
parent b5a4edc9e8
commit b8706c47d6

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -108,7 +108,7 @@ public class AutoConfigurationImportSelector
} }
protected boolean isEnabled(AnnotationMetadata metadata) { protected boolean isEnabled(AnnotationMetadata metadata) {
if (getClass().equals(AutoConfigurationImportSelector.class)) { if (getClass() == AutoConfigurationImportSelector.class) {
return getEnvironment().getProperty( return getEnvironment().getProperty(
EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY, Boolean.class, EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY, Boolean.class,
true); true);

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -80,7 +80,7 @@ class TypeExcludeFiltersContextCustomizer implements ContextCustomizer {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return (obj != null && getClass().equals(obj.getClass()) && this.filters return (obj != null && getClass() == obj.getClass() && this.filters
.equals(((TypeExcludeFiltersContextCustomizer) obj).filters)); .equals(((TypeExcludeFiltersContextCustomizer) obj).filters));
} }

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -62,7 +62,7 @@ class PropertyMappingContextCustomizer implements ContextCustomizer {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return (obj != null && getClass().equals(obj.getClass()) && this.propertySource return (obj != null && getClass() == obj.getClass() && this.propertySource
.equals(((PropertyMappingContextCustomizer) obj).propertySource)); .equals(((PropertyMappingContextCustomizer) obj).propertySource));
} }

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -125,7 +125,7 @@ public class TypeExcludeFiltersContextCustomizerFactoryTests {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return obj.getClass().equals(getClass()); return obj.getClass() == getClass();
} }
} }

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -40,7 +40,7 @@ public class ExampleBasicObject {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj != null && obj.getClass().equals(getClass())) { if (obj != null && obj.getClass() == getClass()) {
return this.value.equals(((ExampleBasicObject) obj).value); return this.value.equals(((ExampleBasicObject) obj).value);
} }
return false; return false;

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -36,7 +36,7 @@ public class ExampleCustomObject {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj != null && obj.getClass().equals(getClass())) { if (obj != null && obj.getClass() == getClass()) {
return this.value.equals(((ExampleCustomObject) obj).value); return this.value.equals(((ExampleCustomObject) obj).value);
} }
return false; return false;

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -346,7 +346,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return (obj != null && getClass().equals(obj.getClass()) return (obj != null && getClass() == obj.getClass()
&& this.key.equals(((ContextCustomizerKey) obj).key)); && this.key.equals(((ContextCustomizerKey) obj).key));
} }

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -144,7 +144,7 @@ public final class TestPropertyValues {
private void addToSources(MutablePropertySources sources, Type type, String name) { private void addToSources(MutablePropertySources sources, Type type, String name) {
if (sources.contains(name)) { if (sources.contains(name)) {
PropertySource<?> propertySource = sources.get(name); PropertySource<?> propertySource = sources.get(name);
if (propertySource.getClass().equals(type.getSourceClass())) { if (propertySource.getClass() == type.getSourceClass()) {
((Map<String, Object>) propertySource.getSource()) ((Map<String, Object>) propertySource.getSource())
.putAll(this.properties); .putAll(this.properties);
return; return;

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -60,7 +60,7 @@ public class TypeExcludeFilter implements TypeFilter, BeanFactoryAware {
public boolean match(MetadataReader metadataReader, public boolean match(MetadataReader metadataReader,
MetadataReaderFactory metadataReaderFactory) throws IOException { MetadataReaderFactory metadataReaderFactory) throws IOException {
if (this.beanFactory instanceof ListableBeanFactory if (this.beanFactory instanceof ListableBeanFactory
&& getClass().equals(TypeExcludeFilter.class)) { && getClass() == TypeExcludeFilter.class) {
Collection<TypeExcludeFilter> delegates = ((ListableBeanFactory) this.beanFactory) Collection<TypeExcludeFilter> delegates = ((ListableBeanFactory) this.beanFactory)
.getBeansOfType(TypeExcludeFilter.class).values(); .getBeansOfType(TypeExcludeFilter.class).values();
for (TypeExcludeFilter delegate : delegates) { for (TypeExcludeFilter delegate : delegates) {

Loading…
Cancel
Save