variable '' of type '' referenced from scope '', but it is not defined 异常解决方法

最近在做一个功能,通过拼接lamdba表达试来实现的功能,但测试时总是出现一个错误,如下图所示,网上也找不到答案,差点都放弃了。。

如上图图所示,我是想通过一个lamdba表达式(上图的IdField属性)来拼接一个新的lamdba表达式(上图的GetById方法中的exp),当然上面只是演示效果,并不是我实际功能的代码。

总是出现异常,我还特意创建另一个lamdba变量exp2,表达式跟exp一样,然后用exp2就不出错,exp跟exp2我比对过,都是一模一样的,真是百思不得其姐。

当然后面我还是解决了,怎么解决呢,如下图

加了一个临时变量,引用IdField属性,然后创建lamdba表达式时用这个临时变量,就不出错了,根据它的报错的翻译,是作用域的问题引用的,具体的我还不懂,先记录下,给同样遇到我这个错误的朋友一点帮助。

variable '' of type '' referenced from scope '', but it is not defined 异常解决方法

原文地址:https://www.cnblogs.com/caijt/p/11875812.html

时间: 2024-08-27 09:36:46

variable '' of type '' referenced from scope '', but it is not defined 异常解决方法的相关文章

The return type is incompatible with JspSourceDependent.getDependants():JasperException问题分析与解决方法

Linux下基于JSP的报表集成到项目中后,显示不出来,查看tomcat的日志,有如下报错信息: The return type is incompatible with JspSourceDependent.getDependants() Stacktrace:] with root cause org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: [33]

Type.GetType()在跨程序集反射时返回null的解决方法

在开发中,经常会遇到这种情况,在程序集A.dll中需要反射程序集B.dll中的类型.如果使用稍有不慎,就会产生运行时错误.例如使用Type.GetType("BNameSpace.ClassName")在程序集A.dll获取程序集B.dll中的类型,就会返回Null. 关于跨程序集的反射,有两点需要注意: 1.如果使用typeof,编译能通过,则跨程序集的反射一定可以正常运行.可以说,typeof是支持强类型的.比如 1 Type supType = typeof(BNameSpace

ValueError: Attempt to reuse RNNCell <tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl.BasicLSTMCell object at 0x7f1a3c448390> with a different variable scope than its first use.解决方法

最近在做生成电视剧本小项目,遇到以下报错 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-16-a2d9a7091ca5> in <module>() 10 input_data_shape = tf.shape(input_text) 11 cell, ini

javax.servlet.ServletException cannot be resolved to a type错误解决方法

在页面中使用全局路径时${pageContext.request.contextPath}出现javax.servlet.ServletException cannot be resolved to a type错误,解决方法如下: 这个错误主要是因为缺少jsp-api.jar 和  servlet-api.jar这两个Jar包. 第一种解决方法: 直接把 Tomcat7.0 下lib目录中的 jsp-api.jar 添加  Build path 中. 第二种解决方法:使用 Maven 将 js

The type javax.servlet.http.HttpServletRequest cannot be resolved.的解决方法

Bug的描述 The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly referenced from required .class files 解决方法 是缺少serverlet的引用库,解决如下 1.工程右键-properties->java build path 2.在java build path的libraries tab页中选择Add external Jars...按钮

关于spring4和hibernate4整合,配置事务报“Cannot unwrap to requested type [javax.sql.DataSource]”错误的解决方法及心得

Cannot unwrap to requested type [javax.sql.DataSource] 配置hibernate4和spring4时,出现错误,解决方法: 1.我去了spring4中的事务配置,数据库可以正常执行并访问.如下: <!-- 配置Hibernate  数据事务 --> <bean id="transactionManager" class="org.springframework.orm.hibernate4.Hibernat

error at ::0 can&#39;t find referenced pointcut pointCutName 错误解决方法

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public final void org.mybatis.spring.support.SqlSessionDaoSupport.setSqlSessionTemplate(org.mybatis.spring.SqlSessionTemplate); nested exception is java.la

[[NSBundle mainBundle] pathForResource:@&quot;name&quot; ofType:@&quot;type&quot;] 找不到对应的文件解决方法

最近在使用[[NSBundle mainBundle] pathForResource:@"name" ofType:@"type"]时,找不到其对应的文件,文件当时是通过 右键->add files to 的方式添加到工程里面的,但是使用[[NSBundle mainBundle] pathForResource:@"name" ofType:@"type"]时,无论如何都找不到文件,经过了重启工程 .clear工程以

Bean named &#39;...&#39; is expected to be of type [...] but was actually of type [com.sun.proxy.$Proxy7解决方法

报错 三月 07, 2017 8:09:52 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh信息: Refreshing org[email protected]41cf53f9: startup date [Tue Mar 07 20:09:52 CST 2017]; root of context hierarchy三月 07, 2017 8:09:52 下午 org.s