001    /**
002     * Copyright (C) 2009 Erik Putrycz <erik.putrycz@gmail.com>
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     *         http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package net.ep.db4o.javassist;
018    
019    import javassist.CtClass;
020    
021    import com.db4o.diagnostic.DiagnosticBase;
022    
023    public class ClassWithFinalMethod extends DiagnosticBase {
024    
025            private CtClass _class;
026            private String _method;
027    
028            public ClassWithFinalMethod(CtClass class1, String method) {
029                    _class = class1;
030                    _method = method;
031            }
032    
033            @Override
034            public String problem() {
035                    return "An object of class "
036                                    + _class.getName()
037                                    + " was stored. The method '" + _method + "' is declared final and thus, cannot be enhanced and use transparent activation.";
038            }
039    
040            @Override
041            public Object reason() {
042                    return _class.getName();
043            }
044    
045            @Override
046            public String solution() {
047                    return "Remove modifier final on the method '"
048                                    + _method + "' of " + _class.getName()
049                                    + ".";
050            }
051    }