Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DubboComponentScan cannot backward support for alibaba @Service and @Reference. #4415

Merged
merged 14 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ private static Object realize0(Object pojo, Class<?> type, Type genericType, fin
history.put(pojo, dest);
for (Object obj : src) {
Type keyType = getGenericClassByIndex(genericType, 0);
Class<?> keyClazz = obj.getClass();
Class<?> keyClazz = obj == null ? null : obj.getClass();
if (keyType instanceof Class) {
keyClazz = (Class<?>) keyType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.HashSet;
import java.util.Map;
import java.util.UUID;

Expand Down Expand Up @@ -682,6 +683,24 @@ public void testDateTimeTimestamp() throws Exception {
assertEquals(dateTimeStr, new SimpleDateFormat(dateFormat[0]).format(timestamp));
}

@Test
public void testRealizeCollectionWithNullElement() {
LinkedList<String> listStr = new LinkedList<>();
listStr.add("arrayValue");
listStr.add(null);
HashSet<String> setStr = new HashSet<>();
setStr.add("setValue");
setStr.add(null);

Object listResult = PojoUtils.realize(listStr, LinkedList.class);
assertEquals(LinkedList.class, listResult.getClass());
assertEquals(listResult, listStr);

Object setResult = PojoUtils.realize(setStr, HashSet.class);
assertEquals(HashSet.class, setResult.getClass());
assertEquals(setResult, setStr);
}

public enum Day {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package com.alibaba.dubbo.config.spring.context.annotation;

import org.apache.dubbo.config.AbstractConfig;
import org.apache.dubbo.config.spring.context.annotation.CompatibleDubboComponentScan;
import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig;

import org.springframework.core.annotation.AliasFor;
Expand All @@ -36,7 +36,7 @@
@Inherited
@Documented
@EnableDubboConfig
@CompatibleDubboComponentScan
@DubboComponentScan
public @interface EnableDubbo {

/**
Expand All @@ -46,9 +46,9 @@
* package names.
*
* @return the base packages to scan
* @see CompatibleDubboComponentScan#basePackages()
* @see DubboComponentScan#basePackages()
*/
@AliasFor(annotation = CompatibleDubboComponentScan.class, attribute = "basePackages")
@AliasFor(annotation = DubboComponentScan.class, attribute = "basePackages")
String[] scanBasePackages() default {};

/**
Expand All @@ -57,9 +57,9 @@
* scanned.
*
* @return classes from the base packages to scan
* @see CompatibleDubboComponentScan#basePackageClasses
* @see DubboComponentScan#basePackageClasses
*/
@AliasFor(annotation = CompatibleDubboComponentScan.class, attribute = "basePackageClasses")
@AliasFor(annotation = DubboComponentScan.class, attribute = "basePackageClasses")
Class<?>[] scanBasePackageClasses() default {};


Expand Down
Loading