| OLD | NEW |
| 1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 31 package com.google.protobuf; | 31 package com.google.protobuf; |
| 32 | 32 |
| 33 import protobuf_unittest.UnittestProto.TestDeprecatedFields; | 33 import protobuf_unittest.UnittestProto.TestDeprecatedFields; |
| 34 |
| 35 import junit.framework.TestCase; |
| 36 |
| 34 import java.lang.reflect.AnnotatedElement; | 37 import java.lang.reflect.AnnotatedElement; |
| 35 import java.lang.reflect.Method; | 38 import java.lang.reflect.Method; |
| 36 import junit.framework.TestCase; | |
| 37 | 39 |
| 38 /** | 40 /** |
| 39 * Test field deprecation | 41 * Test field deprecation |
| 40 * | 42 * |
| 41 * @author birdo@google.com (Roberto Scaramuzzi) | 43 * @author birdo@google.com (Roberto Scaramuzzi) |
| 42 */ | 44 */ |
| 43 public class DeprecatedFieldTest extends TestCase { | 45 public class DeprecatedFieldTest extends TestCase { |
| 44 private String[] deprecatedGetterNames = { | 46 private String[] deprecatedGetterNames = { |
| 45 "hasDeprecatedInt32", | 47 "hasDeprecatedInt32", |
| 46 "getDeprecatedInt32"}; | 48 "getDeprecatedInt32"}; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 70 Method method = deprecatedFieldsBuilder.getMethod(name, int.class); | 72 Method method = deprecatedFieldsBuilder.getMethod(name, int.class); |
| 71 assertTrue("Method " + name + " should be deprecated", | 73 assertTrue("Method " + name + " should be deprecated", |
| 72 isDeprecated(method)); | 74 isDeprecated(method)); |
| 73 } | 75 } |
| 74 } | 76 } |
| 75 | 77 |
| 76 private boolean isDeprecated(AnnotatedElement annotated) { | 78 private boolean isDeprecated(AnnotatedElement annotated) { |
| 77 return annotated.isAnnotationPresent(Deprecated.class); | 79 return annotated.isAnnotationPresent(Deprecated.class); |
| 78 } | 80 } |
| 79 } | 81 } |
| OLD | NEW |