Path: blob/master/test/langtools/tools/jdeprscan/usage/jdk/deprusage/UseField.java
41161 views
/*1* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package jdk.jdeprusage;2425import jdk.deprcases.members.ExampleClass;26import jdk.deprcases.members.ExampleInterface;27import jdk.deprcases.members.ExampleSubclass;2829public class UseField {30static class Direct {31int f(ExampleClass ec) {32return ec.field1;33}34}3536static class Inherited {37int f(ExampleSubclass esc) {38return esc.field2;39}40}4142static class InterfaceInherited {43int f(ExampleSubclass esc) {44return esc.DEP_FIELD2;45}46}4748static class InterfaceDirect {49int f(ExampleInterface ei) {50return ei.DEP_FIELD1;51}52}5354static class FromSubclass extends ExampleClass {55int f() {56return field1;57}58}5960static class SuperFromSubclass extends ExampleClass {61int f() {62return super.field1;63}64}6566static class StaticField {67int f() {68return ExampleClass.staticfield3;69}70}71}727374